How to create a new Collection
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Francisco_Rosas
Posted On:   Thursday, May 30, 2002 10:59 AM

Hi everyone;

I have problems creating a new Collection.



I tried with:



* Collection myCol = null;


* Collection myCol = (Collection) new Object();



...and does not work it out.

Re: How to create a new Collection

Posted By:   christian_cormier  
Posted On:   Thursday, May 30, 2002 02:03 PM

Example :


// create myCollection


List myCollection = new Vector();


// add some object


myCollection.add((Object) object);


...

Re: How to create a new Collection

Posted By:   Steven_Martin  
Posted On:   Thursday, May 30, 2002 11:35 AM

Collection is an interface. To cast a object to a interface that object must implement that interface. Try LinkedList.
About | Sitemap | Contact