public class Interner<E> extends Object
Modifier and Type | Class and Description |
---|---|
protected static class |
Interner.Entry<E>
A weak reference holder that caches the hash code of the referent and is chained in the
entries to handle collisions. |
Constructor and Description |
---|
Interner() |
Interner(int minimumCapacity) |
Modifier and Type | Method and Description |
---|---|
protected void |
addEntry(Interner.Entry<E> entry)
|
protected Interner.Entry<E> |
createEntry(E object,
int hashCode) |
protected boolean |
equals(E object,
E otherObject)
Returns true if the two objects are to be considered equal.
|
protected Interner.Entry<E> |
getEntry(int hashCode)
Gets the first entry in the table with exactly the given hash code.
|
void |
grow(int minimumCapacity)
Ensures that the set has at least the specifies capacity.
|
protected int |
hashCode(E object) |
E |
intern(E object) |
public void grow(int minimumCapacity)
protected Interner.Entry<E> getEntry(int hashCode)
Interner.Entry.getNextEntry()
to yield the next entry with exactly this same hash code.protected int hashCode(E object)
protected boolean equals(E object, E otherObject)
add
,
contains
, get
, intern(Object)
, #remove(Object)
.protected Interner.Entry<E> createEntry(E object, int hashCode)
protected void addEntry(Interner.Entry<E> entry)
Copyright (c) 2011, 2012 Eike Stepper (Berlin, Germany) and others.