[1272] in java-interest

home help back first fref pref prev next nref lref last post

Re: Lists in Java

daemon@ATHENA.MIT.EDU (Lein Ton)
Mon Aug 28 16:07:25 1995

Date: Mon, 28 Aug 1995 12:53:21 -0400
From: ton@cc.gatech.edu (Lein Ton)
To: phil@bga.com, java-interest@java.sun.com

Hi Phil,
try Vector instead of List, it is close enough, if not the same.
Enumeration is a bit cumbersome: an example:


Vector v = new Vector();
v.addElement(o1); // o1 and o2 are arbitrary instantiations
v.addElement(o2);
for (Enumeration e=v.elements;e.hasMoreElements;) {
	Object o = e.nextElement();
 	// sth with o, do a cast (class or interface)
 }
// or
for (int i=0; i<v.size(); i++) {
	Object o = v.elementAt(i);
	// sth with o, do a cast (class or interface)
}
	
I did not test this piece of code, so it may contain some syntax
errors.

have a good one, 
Lein
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post