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 vector 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

Reply via email to