i need to see the content of 2 arrays if there is repitition i need to take only one occurance... Lets say i have 2 arrays arr and arr2 and their content is as below.... arr=abc arr2=123 arr=cde arr2=102 arr=efg arr2=789 arr=abc arr2=123 arr2=abc arr2=456
i need need to count how mnay times an element of arr is being used by different arr2.
so for this set of example... i need to eliminate arr2 because it is the same as arr2... thus the elememt in arr would have counts like this abc = 2 cde=1 efg=1
how to i go about... please help me.... so far this is what i have done....
posted 9 years ago
I'm sorry I don't fully understand your question. It sounds like you may want to make use of a java.util.Set though. A Set does not allow duplicate entries, if you were to dump the contents of your array into a Set you would eliminate any duplicates presuming the contents are not primitives and have appropriate equals() methods.