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?

Was it helpful?

Solution

Set<String> intersection = new HashSet<String>(s1); 
intersection.retainAll(s2);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top