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

+49 votes
asked in CSC285_Fall2018 by (1 point)

4 Answers

+28 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 (1 point)
+28 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 (1 point)
+8

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

+24 votes

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

answered by (1 point)
+5

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

+20 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 (1 point)
...