Re: Vector Storing
- From: "Matt Humphrey" <matth@xxxxxxxxxxxxxx>
- Date: Wed, 31 Jan 2007 07:33:00 -0500
"andrewzzz" <bugpezz@xxxxxxxxx> wrote in message
news:1170237968.812679.56480@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
In a class I have to store and mantain a Vector object.
I can declare it as static, but anyway to access it I have to
initialize the Vector (new Vector()) ... so everytime I create a new
instance of this class I lose my data(??).
actual :
private static Vector dynvector;
in the constructor :
dynvector=new Vector;
dynvector.add(de);//add de to the end of the vector
What should I do to save the content of a vector ???
It's totally unclear what you're trying to accomplish. The two main
possibilities are that you are trying to have each newly created object
(whatever your class stands for) register itself in a vector so that you can
know all of them OR each newly created object contains a list of things, one
of which is the parameter passed to the constructor. You have to first
figure out what you're trying to do. If it's the former, put the new vector
into a static block in the class--it will be initialized once when the class
is loaded. If it's the latter, remove the static keyword from the vector
declaration so that each object has its own list. If it's something else...
Matt Humphrey
.
- References:
- Vector Storing
- From: andrewzzz
- Vector Storing
- Prev by Date: Re: Creating Query from Many Parameters
- Next by Date: Re: hi
- Previous by thread: Re: Vector Storing
- Next by thread: Re: Vector Storing
- Index(es):
Relevant Pages
|