Re: Vector & memory fragmentation



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

.



Relevant Pages

  • Re: Vector & memory fragmentation
    ... >> If I have a Vevtor: ... >> and I am tracking a particular Object within that Vector, ... >> to run for days on end without this developing into a problem somehow. ... >> Thanks, Ike ...
    (comp.lang.java.programmer)
  • Vector & memory fragmentation
    ... If I have a Vevtor: ... and I am tracking a particular Object within that Vector, whereby I obtain ... it;s original position within the Vector, say, int u. ...
    (comp.lang.java.programmer)