56 * attached to this array, nothing happens.
57 * @param listener a listener to remove
58 * @throws NullPointerException if {@code listener} is {@code null}
59 */
60 public void removeListener(ArrayChangeListener<T> listener);
61
62 /**
63 * Sets new length of data in this array. This method grows capacity
64 * if necessary but never shrinks it. Resulting array will contain existing
65 * data for indexes that are less than the current size and zeroes for
66 * indexes that are greater than the current size.
67 * @param size new length of data in this array
68 * @throws NegativeArraySizeException if size is negative
69 */
70 public void resize(int size);
71
72 /**
73 * Grows the capacity of this array if the current capacity is less than
74 * given {@code capacity}, does nothing if it already exceeds
75 * the {@code capacity}.
76 * @param capacity
77 */
78 public void ensureCapacity(int capacity);
79
80 /**
81 * Shrinks the capacity to the current size of data in the array.
82 */
83 public void trimToSize();
84
85 /**
86 * Empties the array by resizing it to 0. Capacity is not changed.
87 * @see #trimToSize()
88 */
89 public void clear();
90
91 /**
92 * Retrieves length of data in this array.
93 * @return length of data in this array
94 */
95 public int size();
96 }
|
56 * attached to this array, nothing happens.
57 * @param listener a listener to remove
58 * @throws NullPointerException if {@code listener} is {@code null}
59 */
60 public void removeListener(ArrayChangeListener<T> listener);
61
62 /**
63 * Sets new length of data in this array. This method grows capacity
64 * if necessary but never shrinks it. Resulting array will contain existing
65 * data for indexes that are less than the current size and zeroes for
66 * indexes that are greater than the current size.
67 * @param size new length of data in this array
68 * @throws NegativeArraySizeException if size is negative
69 */
70 public void resize(int size);
71
72 /**
73 * Grows the capacity of this array if the current capacity is less than
74 * given {@code capacity}, does nothing if it already exceeds
75 * the {@code capacity}.
76 * @param capacity the {@code capacity} of this array
77 */
78 public void ensureCapacity(int capacity);
79
80 /**
81 * Shrinks the capacity to the current size of data in the array.
82 */
83 public void trimToSize();
84
85 /**
86 * Empties the array by resizing it to 0. Capacity is not changed.
87 * @see #trimToSize()
88 */
89 public void clear();
90
91 /**
92 * Retrieves length of data in this array.
93 * @return length of data in this array
94 */
95 public int size();
96 }
|