public class mVector extends Vector implements DataUnit
Here is an example showing a vector being used:
... Vector vec = new Vector(); vec.add(obj1); vec.add(obj2); ... vec.insert(3, obj3); vec.del(2); if (vec.getCount() > 5) ...
capacityIncrement, elementCount, elementDataserialVersionUID| Constructor and Description |
|---|
mVector()
Constructs an empty vector.
|
mVector(int size)
Constructs an empty vector with a given initial size.
|
mVector(int size,
int incrementCount) |
mVector(Object[] items) |
mVector(Vector items) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index,
Object obj)
Inserts an object at the given index.
|
static Vector |
add(Vector v,
Object toAdd)
This adds an object to the end of the Vector v.
|
void |
addAll(Object[] objs) |
void |
addAll(Object[] objs,
int start,
int length)
Finds the index of the given object using the compare() method.
|
void |
addAll(Vector objs) |
static Vector |
addAll(Vector dest,
Object[] data) |
void |
addCopiesFrom(Object[] object,
int start,
int length) |
static Vector |
cacheAllElements(Vector v)
Remove elements from the vector and cache them.
|
void |
clear()
Clear the collection, such that a subsequent call to isEmpty() would
return true.
|
int |
compareTo(Object other)
This just compares the sizes of the two vectors.
|
protected void |
copied(Object from)
This method is called after the base implementation of copyFrom() is executed.
|
void |
copyCopiesFrom(Object other) |
void |
copyFrom(Object other)
This does not make copies of the elements of the other Object.
|
void |
copyInto(Object[] array)
The destination array MUST be big enough to hold the vector.
|
void |
copyInto(Object[] array,
int destPos)
The destination array MUST be big enough to hold the vector.
|
void |
del(int index)
Deletes the object reference at the given index.
|
Object |
find(ObjectFinder finder) |
Object |
get(int index)
Get the element at a particular index.
|
Object |
getCopy()
Return a copy of this object.
|
int |
getCount()
Returns the number of objects in the vector.
|
mVector |
getFullCopy()
This returns a Vector that is a copy of this one, where all the items
are themselves copies of the original items.
|
Object |
getNew()
Return a new Object which is of the same class as the original.
|
void |
insert(int index,
Object obj)
Deprecated.
Use add(index,obj) instead.
|
static Iterator |
iterator(Vector v)
This returns an iterator for the specified Vector.
|
static Vector |
newVector(Object[] data) |
static Object |
pop(Vector v)
This removes and returns the object at the front of the Vector v.
|
static Vector |
push(Vector v,
Object toPush)
This inserts an object to the front of the Vector v.
|
static int |
size(Collection c) |
Object[] |
toArray()
Create a new Object array and copy all the elements into it.
|
Object[] |
toArray(Class elementType)
Create and return an array of objects that contain the contents of this mVector.
|
Object[] |
toArray(Object[] dest)
Copy the vector into the destination array, creating a new one if the provided destination is not
big enough to hold all the elements.
|
static Object[] |
toArray(Vector source) |
static Object[] |
toArray(Vector src,
Class elementType)
Create and return an array of objects that contain the contents of the supplied Vector.
|
Object[] |
toObjectArray()
Converts the vector to an array of objects.
|
String |
toString()
Return a String representation of this object.
|
add, addAll, addAll, addElement, capacity, clone, contains, containsAll, elementAt, elements, ensureCapacity, firstElement, indexOf, indexOf, insertElementAt, isEmpty, iterator, lastElement, lastIndexOf, lastIndexOf, remove, removeAll, removeAllElements, removeElement, removeElementAt, retainAll, setElementAt, setSize, size, trimToSizeequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitequals, hashCodepublic mVector()
public mVector(int size)
public mVector(int size,
int incrementCount)
public mVector(Object[] items)
public mVector(Vector items)
public void copyFrom(Object other)
protected void copied(Object from)
from - The object that data was copied from.public void addCopiesFrom(Object[] object, int start, int length)
public void copyCopiesFrom(Object other)
public mVector getFullCopy()
public void insert(int index,
Object obj)
index - The index to insert the object.obj - The object to add.public void add(int index,
Object obj)
public void del(int index)
public Object get(int index)
Vectorpublic int getCount()
public Object[] toObjectArray()
public void clear()
Collectionclear in interface Collectionclear in class Vectorpublic void addAll(Object[] objs, int start, int length)
public void addAll(Object[] objs)
public void addAll(Vector objs)
public void copyInto(Object[] array, int destPos)
public void copyInto(Object[] array)
public Object find(ObjectFinder finder)
public static Vector add(Vector v, Object toAdd)
public static Vector push(Vector v, Object toPush)
public static Object pop(Vector v)
public static Iterator iterator(Vector v)
public Object[] toArray(Object[] dest)
toArray in interface CollectiontoArray in class Vector[] - dest A destination object array to copy the vector elements into.public Object[] toArray()
toArray in interface CollectiontoArray in class Vectorpublic Object getNew()
DataUnitpublic Object getCopy()
Copyablepublic int compareTo(Object other)
compareTo in interface Comparablepublic String toString()
Objectpublic static Vector cacheAllElements(Vector v)
public Object[] toArray(Class elementType)
elementType - the type of the Object array to return. If this is null Object.class is used.public static Object[] toArray(Vector src, Class elementType)
src - the Vector to get the objects from. If this is null an empty array is returned.elementType - the type of the Object array to return. If this is null Object.class is used.public static int size(Collection c)