Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+47 votes
asked in CSC285_Fall2018 by (8 points)

4 Answers

+27 votes

So Professor Stonedahl recommended to use the Collections.disjoint method in this problem. In order to use that method, you first have to turn the String Arrays into a collection. Going that route will make the problem much easier.

answered by (8 points)
+27 votes

This might help: https://www.geeksforgeeks.org/java-util-collections-disjoint-method-java-examples/

Of course, there are other ways to solve it too...

answered by (8 points)
+7

The second example on that page is helpful if you are unsure how to turn the String Arrays into a collection.

+23 votes

Another hint: the Collections.disjoint method doesn't work for array type

answered by (8 points)
+4

There should be a method in ArrayList class called asList which can help converting an array into a list

+19 votes

You will see in the hint that if you want to use Collections.disjoint() method, you will need to create an arraylist first. Therefore, you need to create 2 arraylists and move all the number from 2 array to new arraylists. Then use Collections.disjoint() to complete this problem.

answered by (8 points)
...