This is pointless, Vector implements the Collection interface, no need to cast it here.
-----Original Message----- From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]] On Behalf Of Rodelio Pagui Sent: Saturday, May 11, 2002 2:02 AM To: [EMAIL PROTECTED] Subject: Re: Collections initialization you can not initialize a collection. you need to use a vector, hashset, arraylist, linkedlist or any of its implementation (please refer to javadoc). but if you really need a collection, just type cast any instance of a collection implementation class to a collection variable. consider the ff: class VectorToCollection{ public static void main (String args[]) { //create an instance of a ve<3CD class java.util.Vector v = new java.util.Vector(); //populate the vector v.add("one"); v.add("two"); v.add("three"); //assign the values of the vector to a collection by type casting java.util.Collection c = (java.util.Collection) v; java.util.Iterator i = c.iterator(); while(i.hasNext()){ System.out.println(i.next()); } } } ======================================================================== === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com
