Associate
- Joined
- 23 Aug 2004
- Posts
- 1,493
I have a set, typically with >1 element in it. I need a method, that iterates the set, and returns each individual element for other methods. I thought this would work, however, it only returns one element. Any ideas?
public Object iterateSet()
{
it = set.iterator();
while(it.hasNext())
{
Object a = it.next();
return a;
}
return null;
}
public Object iterateSet()
{
it = set.iterator();
while(it.hasNext())
{
Object a = it.next();
return a;
}
return null;
}