Re: Vector & memory fragmentation
- From: "John Currier" <md4curvs@xxxxxxxxx>
- Date: 28 Jul 2005 18:49:40 -0700
Ike wrote:
> If I have a Vevtor:
>
> Vector vector = new Vector();
>
> and I am tracking a particular Object within that Vector, whereby I obtain
> it;s original position within the Vector, say, int u. Then say, through
> various Vector operations, the location of that particular Object is no
> longer at u; Therefore, I periodically want to reset it back to being in
> position u within the Vector.
>
> Presently, I do this with :
>
> vector.removeElement(myObject);
> vector.insertElementAt(myObject, u);
>
> But I am not so certain this is the "best" way to do this. My concern is
> memory fragmentation, or, more generally, the ability for such a procedure
> to run for days on end without this developing into a problem somehow.
>
> Given that, is there a better way to accomplish what I am doing here?
> Thanks, Ike
What problem are you really trying to solve by tracking the object
within the vector? We may have a more elegant approach for you.
John
http://schemaspy.sourceforge.net
.
- References:
- Vector & memory fragmentation
- From: Ike
- Vector & memory fragmentation
- Prev by Date: Re: Java install on Linux FC4 (Two very basic questions).
- Next by Date: Re: Null pointer exception
- Previous by thread: Re: Vector & memory fragmentation
- Next by thread: ANOMALIES TRYING TO COMPILE JAVA CODE FROM WITH IN A RUNNING JAVA APPLICATION
- Index(es):
Relevant Pages
|