tokenizing objects in a list

Hi i have a list of object, in the form emailAddress=float, like below

[anne@gmail.com=3.245392,steven@hotmail.com=0.32849...]

What i need to do is split these objects up so that i just have the email address, so in this example i would just have

anne and steven

I have been trying to use a string tokenizer and splitting the object at the = sign

List list1 =new ArrayList();

Iterator it = likely.iterator();

while(it.hasNext()){

Object e = (Object)it.next();

StringTokenizer st =new StringTokenizer((String)e," =");

while(st.hasMoreTokens())

list1.add(st.nextToken());

}

System.out.println("List " + list1);

This however is not working, does anybody know of a way i can implement this, id appreciate any help

Thanks

[1052 byte] By [oraistea] at [2007-10-2 13:58:36]
# 1
StringTokenizer works on strings, try converting your object toString() before using the StringTokenizer
obadarea at 2007-7-13 12:03:58 > top of Java-index,Core,Core APIs...
# 2

I wouldn't use a tokenizer for this, personally. Your format is very simple, so I'd try String.split.

Given a string of the format:

formattedString ::= item [, item [, item ... ] ]

item ::= email '=' float

I would put together something like this:

String formattedString = ...;

String[] items = formattedString.split(',');

for (String item : items)

{

String prefix = item.substring(0, item.indexOf('@'));

...

}

Why are you doing this, if you don't mind my asking? I certainly hope I'm not helping a spammer spider some webpage. :-P

Cheers!

tvynra at 2007-7-13 12:03:58 > top of Java-index,Core,Core APIs...