(int capacity)
| 47 | } |
| 48 | |
| 49 | private void resize(int capacity) { |
| 50 | Object[] newArray = null; |
| 51 | if (capacity != 0) { |
| 52 | if (array != null && array.length == capacity) { |
| 53 | return; |
| 54 | } |
| 55 | |
| 56 | newArray = new Object[capacity]; |
| 57 | if (array != null) { |
| 58 | System.arraycopy(array, 0, newArray, 0, size); |
| 59 | } |
| 60 | } |
| 61 | array = newArray; |
| 62 | } |
| 63 | |
| 64 | private static boolean equal(Object a, Object b) { |
| 65 | return (a == null && b == null) || (a != null && a.equals(b)); |