I was reading some code that encouraged the use of vectors but my IDE is saying that it is an obsolete Collection.

I need to use Vector because it can does not need to be a set size. and I would
like to have a Vector of Vectors. Is there some other way to do this?
Maybe an example of a list of list or some other kind of collection.
thanks

http://www.java2s.com/Tutorial/Java/0140__Collections/MultidimensionalVectorsVectorsofVectors.htm

http://download.oracle.com/javase/6/docs/api/java/util/Vector.html

Thanks I have not used vectors a whole lot. The links were good links to add to my collection.


The Vector class said:

As of the Java 2 platform v1.2, this class was retrofitted to implement the List interface, making it a member of the Java Collections Framework. Unlike the new collection implementations, Vector is synchronized.

and my ide says:

This inspection reports any uses of java.util.Vector or java.util.Hashtable. While still supported, these classes were made obsolete by the JDK1.2 collection classes, and should probably not be used in new development.

The Api did not mention anything about Vector being depreciated or obsolete.
I guess my IDE is out dated.

Thank god. I just spent 4 hours working aroud it. Vectors are our friend!
I'll be happy to delete all of it and start over.

take care

don't forget to use a WildCard, f.e. Vector<String>, Vecto<Vector<Object>>... everyting about that is on Web

don't forget to use a WildCard, f.e. Vector<String>, Vecto<Vector<Object>>... everyting about that is on Web

Ok, Wild card you got me there I will have to spend more time on

vectors.

All I thought I knew about Vectors is that there was no data type when
loading it and

to unload it I had to cast the element on the way out.

for (Enumeration e = frameVector.elements(); e.hasMoreElements();) {
            JInternalFrame frame = (JInternalFrame) e.nextElement();
            createKeyAndValues(frame);
        }

just google Vectors +wildCard ?

I was reading some code that encouraged the use of vectors but my IDE is saying that it is an obsolete Collection.

I need to use Vector because it can does not need to be a set size. and I would
like to have a Vector of Vectors. Is there some other way to do this?
Maybe an example of a list of list or some other kind of collection.
thanks

Your IDE is saying it is obsolete because ArrayList, LinkedList, etc have replaced the Vector class. I think I remember from class that for the most part Vectors are not used except when we needed multi-threading/synchronization safety? and even then its wasn't implemented very well. Here's a discussion on stack overflow about the Vector class and why it is obsolete link.

ArrayList are not synchronized while Vector are.
No way Vactor will become obsolete. And yes you can use Vector of Vector. JTable use them

Vector class *has* become obsolete. If you need a synchronized List, just wrap the plain old ArrayList class inside the Collections.synchronizedList call. In short, don't use Vectors unless you are tied to an API which forces you to use it.

Also, don't rely on synchronized collections when it comes to handling race conditions; they synchronize individual calls and not logical calls which you actually should have synchronized.

Interesting. I will have to look at the List Collections.synchronizedList and
find out how it will work with my present operation.

I have wrote a rough draft of a List that is loaded with DateTimes.From each element I can extrapolate three pieces of data that need to be kept together and synchronized with related data from a record. Some list will not guarantee everytning will be kept in order.

The whole operation is to end up with several data types to be turned into strings
and used to query and insert in a db.

Needless to say Collections.list,arrays etc. will make it quite confusing.

Thanks for the info and I will end this post saying I am going to explore the Enumeration maybe I will find that they are the solution.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.