public void removeEntry(CentralizedThreadLocal<?> key) { int index = key._hashCode & (_table.length - 1); Entry previousEntry = null; Entry entry = _table[index]; while (entry != null) { Entry nextEntry = entry._next; if (entry._key == key) { _size--; if (previousEntry == null) { _table[index] = nextEntry; } else { previousEntry._next = nextEntry; } return; } previousEntry = entry; entry = nextEntry; } }
public Entry addBefore(final Object o) { Entry newEntry = new Entry(o, this, _previous); _previous._next = newEntry; _previous = newEntry; LjtLinkedList.this.size++; return newEntry; }
public void expand(int newCapacity) { if (_table.length == _MAXIMUM_CAPACITY) { _threshold = Integer.MAX_VALUE; return; } Entry[] newTable = new Entry[newCapacity]; for (int i = 0; i < _table.length; i++) { Entry entry = _table[i]; if (entry == null) { continue; } _table[i] = null; do { Entry nextEntry = entry._next; int index = entry._key._hashCode & (newCapacity - 1); entry._next = newTable[index]; newTable[index] = entry; entry = nextEntry; } while (entry != null); } _table = newTable; _threshold = newCapacity * 2 / 3; }
public void readExternal(ObjectInput s) throws IOException, ClassNotFoundException { int size = s.readInt(); header = new Entry(null, null, null); header._next = header._previous = header; for (int i = 0; i < size; i++) { addLast(s.readObject()); } }
private final void transfer(Entry[] newTable) { Entry[] src = _table; int newCapacity = newTable.length; for (int j = 0; j < src.length; j++) { Entry e = src[j]; if (e != null) { src[j] = null; do { Entry next = e._next; int i = indexFor(e._hash, newCapacity); e._next = newTable[i]; newTable[i] = e; e = next; } while (e != null); } } }
public LjtLinkedList() { header._next = header._previous = header; }
public void remove() { _previous._next = _next; _next._previous = _previous; LjtLinkedList.this.size--; }
public void clear() { header._next = header._previous = header; size = 0; }