Set<String> intersection = new HashSet<String>(s1);
intersection.retainAll(s2);
How to compare the elements of a SortedSet to see how many elements of the two sets match
Question
I'm writing a program that tests lottery pick programs for statistical analysis. I pretty much have an idea of how to store the data. My question is: how I can take two sortedsets of equal size (I have a method that checks that), compare them and return a number that represents the number of matching elements in both sets?
I can post my code, but really I have no idea what method to use. I want to know what way I'm going to solve this before I code too much. Should I use the hashcode method or some other way to attack this issue?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow