I have written following java code:
public static void main(String[] args) {
Vector vector = new Vector();
for(int i=1; i<=10; i++)
vector.addElement(i);
Enumeration vEnum = vector.elements();
while(vEnum.hasMoreElements())
System.out.println(vEnum.nextElement());
}
While compiling it getting following warning message:
Note: TestJavaApplication.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
And Netbeans complaining with a message of "Obsolete Collection".
What do you recommend me in this situation?
Note, that I need to use Vector in J2ME application as a dynamic array that stores the order of the elements. I would be happy using Hashtable but unfortunately it doesn't store the order of its elements.
EDIT 1
After reviewing this answer I changed the declaration from Vector vector = new Vector();
into Vector<String> vector = new Vector<String>();
. And now getting another warning message:
TestJavaApplication.java:2: warning: com.sun.org.apache.xerces.internal.parsers.IntegratedParserConfiguration is Sun proprietary API and may be removed in a future release
import com.sun.org.apache.xerces.internal.parsers.IntegratedParserConfiguration;
^
Thank you.