Re: java.util.Enumeration - Array List Question
Re: java.util.Enumeration - Array List Question
- Subject: Re: java.util.Enumeration - Array List Question
- From: James Cicenia <email@hidden>
- Date: Fri, 9 Apr 2004 10:33:08 -0500
isn't your return breaking you out of your first iteration?
-James
On Apr 9, 2004, at 10:15 AM, Janice M. Cheung wrote:
Greetings!
I'm having problems returning an array List of PersonContacts ..
Is there a way for the InterfaceEnumeration method to return
e.allElements() instead of e.nextElement() ?
My function is only returning one phone number, instead of a list
of all work, cell, and fax numbers..
Here is my function:
public Contact getPersonContact(){
NSArray pc = (NSArray)storedValueForKey("contacts");
java.util.Enumeration e = pc.objectEnumerator();
String myTels = "";
while (e.hasMoreElements()) {
Contact con = (Contact)e.nextElement();
String phone = " ";
String fax = " " ;
String cell = " " ;
if ((con.phoneNumer() != null)) {
if ((con.deviceType().equals("Phone"))) {
phone =
formatPhoneNumber(con.phoneNumber()) + " (w)\n";
}
if ((con.deviceType().equals("Phone"))) {
fax =
formatPhoneNumber(con.phoneNumber()) + " (w)\n";
}
if ((con.deviceType().equals("Phone"))) {
cell =
formatPhoneNumber(con.phoneNumber()) + " (w)\n";
}
myTels = myTels + " " + phone + " " +
fax + " " + phone;
} return con;
}
return null;
}
I'm not sure of what I'm exactly missing .. but
I would like for:
Contact con = (Contact)e.nextElement();
to somehow include + con .. to generate the entire list
..
Any help or guidance would be greatly appreciated!
Thanks very much!!
Happy Good Friday!!! :-)
Janice
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.