Esempio n. 1
0
 @SuppressWarnings("unchecked")
 public void ensureCapacity(int minCapacity) {
   opcount++;
   if (minCapacity > a.length) {
     int newCapacity = Math.max(minCapacity, a.length * 2);
     final T[] temp = (T[]) new Object[newCapacity];
     for (int i = a.length - 1; i >= 0; i--) temp[i] = a[i];
     a = temp;
   }
 }
Esempio n. 2
0
 public ResizingArray(int N) {
   this(N, Math.max(N, 4));
 }