/** * Expands the set to accommodate new values. * * @param newCapacity an <code>int</code> value */ @Override protected void rehash(int newCapacity) { TIntLinkedList oldOrder = new TIntLinkedList(order); int oldSize = size(); Object oldSet[] = _set; order.clear(); _set = new Object[newCapacity]; Arrays.fill(_set, FREE); for (TIntIterator iterator = oldOrder.iterator(); iterator.hasNext();) { int i = iterator.next(); E o = (E) oldSet[i]; if (o == FREE || o == REMOVED) { throw new IllegalStateException("Iterating over empty location while rehashing"); } if (o != FREE && o != REMOVED) { int index = insertKey(o); if (index < 0) { // everyone pays for this because some people can't RTFM throwObjectContractViolation(_set[(-index - 1)], o, size(), oldSize, oldSet); } if (!order.add(index)) throw new IllegalStateException("Order not changed after insert"); } } }
/** * Expands the set to accommodate new values. * * @param newCapacity an <code>int</code> value */ @Override protected void rehash(int newCapacity) { TIntLinkedList oldOrder = new TIntLinkedList(order); int oldSize = size(); Object oldSet[] = _set; order.clear(); _set = new Object[newCapacity]; Arrays.fill(_set, FREE); for (TIntIterator iterator = oldOrder.iterator(); iterator.hasNext();) { int i = iterator.next(); E o = (E) oldSet[i]; if (o == FREE || o == REMOVED) { throw new IllegalStateException("Iterating over empty location while rehashing"); } if (o != FREE && o != REMOVED) { int index = insertKey(o); if (index < 0) { // everyone pays for this because some people can't RTFM throwObjectContractViolation(_set[(-index - 1)], o, size(), oldSize, oldSet); } if (!order.add(index)) throw new IllegalStateException("Order not changed after insert"); } } }
/** * Expands the set to accommodate new values. * * @param newCapacity an <code>int</code> value */ @Override @SuppressWarnings("unchecked") protected void rehash(int newCapacity) { TIntLinkedList oldOrder = new TIntLinkedList(order); int oldSize = size(); Object oldSet[] = _set; order.clear(); _set = new Object[newCapacity]; Arrays.fill(_set, FREE); for (TIntIterator iterator = oldOrder.iterator(); iterator.hasNext();) { int i = iterator.next(); E o = (E) oldSet[i]; if (o == FREE || o == REMOVED) { throw new IllegalStateException("Iterating over empty location while rehashing"); } if (o != FREE && o != REMOVED) { int index = insertKey(o); if (index < 0) { // everyone pays for this because some people can't RTFM throwObjectContractViolation(_set[(-index - 1)], o, size(), oldSize, oldSet); } if (!order.add(index)) throw new IllegalStateException("Order not changed after insert"); } } }