private void attachImpl(Env env, StringValue hash, Value obj, Value value) { ObjectEntry entry = _objMap.get(hash); if (entry == null) { entry = new ObjectEntry(hash, obj, value); if (_tail != null) { _tail.setNext(entry); entry.setPrev(_tail); } _tail = entry; if (_head == null) { _head = entry; } } else { entry.setObject(obj); entry.setValue(value); } _objMap.put(hash, entry); }
private void detachImpl(Env env, StringValue hash) { ObjectEntry entry = _objMap.remove(hash); if (entry == null) { return; } ObjectEntry prev = entry.getPrev(); ObjectEntry next = entry.getNext(); if (prev != null) { prev.setNext(next); } if (next != null) { next.setPrev(prev); } if (entry == _tail) { _tail = entry.getPrev(); } if (entry == _head) { _head = entry.getNext(); } }