MCPcopy Create free account
hub / github.com/davidgiven/luje / Vector

Class Vector

lib/java/util/Vector.java:39–1046  ·  view source on GitHub ↗

Vector is a variable size contiguous indexable array of objects. The size of the vector is the number of objects it contains. The capacity of the vector is the number of objects it can hold. Objects may be inserted at any position up to the size of the vector, thus increasing the size of the vec

Source from the content-addressed store, hash-verified

37 * @see java.lang.StringBuffer
38 */
39public class Vector<E> extends AbstractList<E> implements List<E>,
40 RandomAccess, Cloneable, Serializable {
41
42 private static final long serialVersionUID = -2767605614048989439L;
43
44 /**
45 * The number of elements or the size of the vector.
46 */
47 protected int elementCount;
48
49 /**
50 * The elements of the vector.
51 */
52 protected Object[] elementData;
53
54 /**
55 * How many elements should be added to the vector when it is detected that
56 * it needs to grow to accommodate extra entries. If this value is zero or
57 * negative the size will be doubled if an increase is needed.
58 */
59 protected int capacityIncrement;
60
61 private static final int DEFAULT_SIZE = 10;
62
63 /**
64 * Constructs a new vector using the default capacity.
65 */
66 public Vector() {
67 this(DEFAULT_SIZE, 0);
68 }
69
70 /**
71 * Constructs a new vector using the specified capacity.
72 *
73 * @param capacity
74 * the initial capacity of the new vector.
75 * @throws IllegalArgumentException
76 * if {@code capacity} is negative.
77 */
78 public Vector(int capacity) {
79 this(capacity, 0);
80 }
81
82 /**
83 * Constructs a new vector using the specified capacity and capacity
84 * increment.
85 *
86 * @param capacity
87 * the initial capacity of the new vector.
88 * @param capacityIncrement
89 * the amount to increase the capacity when this vector is full.
90 * @throws IllegalArgumentException
91 * if {@code capacity} is negative.
92 */
93 public Vector(int capacity, int capacityIncrement) {
94 if (capacity < 0) {
95 throw new IllegalArgumentException();
96 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected