hello sir i am using hashset of type integer in my code
HashSet<Integer> set = new HashSet<Integer>();
for(int j=0;j<2;j++){
if(set.contains(l[i][j])==false){
set.add(l[i][j]);
//System.out.print(set);
//System.out.print(" "+l[i][j]);
}
}
Iterator iterator =set.iterator();
while(iterator.hasNext())
{
System.out.println(iterator.next());
}
and want to eliminate duplicate from that but its not working output is
[0][0, 4]
[1][1, 7]
[2][2, 8]
[3][3, 9]
[4][0, 4]
[5][5, 9]
[0]
[7][1, 7]
[8][2, 8]
[9][5, 9]
i don't want similar items like [0, 4] repeating
so please help me
Comments
Leave a comment