public static HashSet<Integer> removeAllNumbersGreaterThan10(HashSet<Integer> set) {
// write your code here
Iterator<Integer> itr= set.Iterator();
while(itr.hasNext()){
if(itr.next()>10){itr.remove(); }
}
return set;
what's wrong with my code? it can't compile
Under discussion
Comments (1)
- Popular
- New
- Old
You must be signed in to leave a comment
Brandon
24 May 2020, 04:42
You really should include the whole question/code block like most people do on the help section.
That being said, I'm like 90% sure your issue is the capital I in itr= set.Iterator(); If it was lowercase, I think it'd work for you.
0