104
105 /**
106 * Remove the object at a specified index.
107 * @param index the index of the entry to be removed.
108 */
109 public synchronized void remove(int index) {
110 if (index >= keys.size())
111 return;
112
113 keys.removeElementAt(index);
114 values.removeElementAt(index);
115 }
116
117 /**
118 * Get the index of the target in the table.
119 * This is a reference equality search.
120 * @param data the vector in which to search
121 * @param target the object to search for
122 * @return the index of the target in the vector, or -1 if not found
123 */
124 protected int findIndex(Vector data, Object target) {
125 for (int i = 0; i < data.size(); i++)
126 if (data.elementAt(i) == target)
127 return i;
128
129 return -1;
130 }
131
132 private Vector<Object> keys, values;
133 }
134
135
|
104
105 /**
106 * Remove the object at a specified index.
107 * @param index the index of the entry to be removed.
108 */
109 public synchronized void remove(int index) {
110 if (index >= keys.size())
111 return;
112
113 keys.removeElementAt(index);
114 values.removeElementAt(index);
115 }
116
117 /**
118 * Get the index of the target in the table.
119 * This is a reference equality search.
120 * @param data the vector in which to search
121 * @param target the object to search for
122 * @return the index of the target in the vector, or -1 if not found
123 */
124 protected int findIndex(Vector<?> data, Object target) {
125 for (int i = 0; i < data.size(); i++)
126 if (data.elementAt(i) == target)
127 return i;
128
129 return -1;
130 }
131
132 private Vector<Object> keys, values;
133 }
134
135
|