Re: iterator.
- From: Roedy Green <my_email_is_posted_on_my_website@xxxxxxxxxxxxxx>
- Date: Thu, 29 Dec 2005 19:17:06 GMT
On Thu, 29 Dec 2005 13:55:50 -0500, "ste1986" <steiddon_1@xxxxxxxxxxx>
wrote, quoted or indirectly quoted someone who said :
>public volunteer.add(new Volunteer(String name, int telephone))
> {
> Iterator it = volunteers.iterator();
> while (it.hasNext())
> {
> Volunteers volunteers = (Volunteers) it.next();
> if (volunteers.getName().equals(name))
> return true;
> }
> return false;
> }
>}
What is this supposed to be?
If a method declaration, you can't have a dot in a method name.
If this is supposed to be an anonymous class, then you don't want the
word public there.
Iterators are more neatly handled with for:each.
The contains method might do what you want if your volunteers supports
it.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
.
- References:
- iterator.
- From: ste1986
- iterator.
- Prev by Date: iterator.
- Next by Date: Re: iterator.
- Previous by thread: iterator.
- Next by thread: Re: iterator.
- Index(es):