Answer to Question #5825 in Java | JSP | JSF for k pravin

Question #5825
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
0
Expert's answer

Answer in progress...

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS