1 |
/* Collections.java -- Utility class with methods to operate on collections |
/* Collections.java -- Utility class with methods to operate on collections |
2 |
Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. |
Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
726 |
} |
} |
727 |
|
|
728 |
/** |
/** |
729 |
* Returns an array list holding the elements visited by a given |
* Returns an ArrayList holding the elements visited by a given |
730 |
* Enumeration. This method exists for interoperability between legacy |
* Enumeration. This method exists for interoperability between legacy |
731 |
* APIs and the new Collection API. |
* APIs and the new Collection API. |
732 |
* |
* |
735 |
* @see ArrayList |
* @see ArrayList |
736 |
* @since 1.4 |
* @since 1.4 |
737 |
*/ |
*/ |
738 |
public static List list(Enumeration e) |
public static ArrayList list(Enumeration e) |
739 |
{ |
{ |
740 |
List l = new ArrayList(); |
ArrayList l = new ArrayList(); |
741 |
while (e.hasMoreElements()) |
while (e.hasMoreElements()) |
742 |
l.add(e.nextElement()); |
l.add(e.nextElement()); |
743 |
return l; |
return l; |