Saturday, 24 August 2013

Searching in HashSet

Searching in HashSet

I have 2 HashSet
Set<String> firstSet = new HashSet<String>();
Set<String> secondSet= new HashSet<String>();
Suppose
firstSet contains String as [A-ABC,B-BCD,C-CDE,D-DEF,L-POK];
secondSet contains String as [A,B,C,D,L,K,M];
Can i split each elements within firstSet like [A,B,C] without for loop
and then do
firstSet.contains(secondSet);
or is their any appropriate way for doing this ?

No comments:

Post a Comment