116 for (int i = 0; i<tmp.length-1; i+=2) {
117 if (tmp[i].equals(key)) {
118 tmp[i+1]=value;
119 break;
120 }
121 }
122 } else {
123 Object[] array = (Object[])table;
124 int i = array.length;
125 Object[] tmp = new Object[i+2];
126 System.arraycopy(array, 0, tmp, 0, i);
127
128 tmp[i] = key;
129 tmp[i+1] = value;
130 table = tmp;
131 }
132 } else { // We are a hashtable
133 if ((size==ARRAY_BOUNDARY) && isArray()) {
134 grow();
135 }
136 ((Hashtable<Object,Object>)table).put(key, value);
137 }
138 }
139 }
140
141 /*
142 * Gets the value for key
143 */
144 public Object get(Object key) {
145 Object value = null;
146 if (table !=null) {
147 if (isArray()) {
148 Object[] array = (Object[])table;
149 for (int i = 0; i<array.length-1; i+=2) {
150 if (array[i].equals(key)) {
151 value = array[i+1];
152 break;
153 }
154 }
155 } else {
156 value = ((Hashtable)table).get(key);
|
116 for (int i = 0; i<tmp.length-1; i+=2) {
117 if (tmp[i].equals(key)) {
118 tmp[i+1]=value;
119 break;
120 }
121 }
122 } else {
123 Object[] array = (Object[])table;
124 int i = array.length;
125 Object[] tmp = new Object[i+2];
126 System.arraycopy(array, 0, tmp, 0, i);
127
128 tmp[i] = key;
129 tmp[i+1] = value;
130 table = tmp;
131 }
132 } else { // We are a hashtable
133 if ((size==ARRAY_BOUNDARY) && isArray()) {
134 grow();
135 }
136 @SuppressWarnings("unchecked")
137 Hashtable<Object,Object> tmp = (Hashtable<Object,Object>)table;
138 tmp.put(key, value);
139 }
140 }
141 }
142
143 /*
144 * Gets the value for key
145 */
146 public Object get(Object key) {
147 Object value = null;
148 if (table !=null) {
149 if (isArray()) {
150 Object[] array = (Object[])table;
151 for (int i = 0; i<array.length-1; i+=2) {
152 if (array[i].equals(key)) {
153 value = array[i+1];
154 break;
155 }
156 }
157 } else {
158 value = ((Hashtable)table).get(key);
|