Note
It is very important to use a smaller load factor than you normally would for HashSet, since the implementation is open-addressed with linear probing. With a 50% load-factor a get is expected to return in only 2 probes. However, a 90% load-factor is expected to return in around 50 probes.
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| private static class | |
| private class | |
| public class | |
| private static class | |
| private static class | |
| private static class | |
| private static class | |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private static final int | DEFAULT_CAPACITY
Same default as HashMap, must be a power of 2 |
| private static final float | DEFAULT_LOAD_FACTOR
67%, just like IdentityHashMap |
| private final Class | elementType
The class of values that may be present in |
| private transient StrongInternPool | index
Cache for an index |
| private final float | loadFactor
The user defined load factor which defines when to resize |
| private static final int | MAXIMUM_CAPACITY
MAX_INT - 1 |
| private transient int | modCount
Counter used to detect changes made outside of an iterator |
| private static final Object | NULL
Marks null keys. |
| private static final long | serialVersionUID
Serialization ID |
| private transient int | size
The current number of key-value pairs |
| private transient Object[] | |
| private transient int | threshold
The next resize |
| Access | Constructor and Description |
|---|---|
| pack-priv | |
| pack-priv | |
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public StrongInternPool | |
| public boolean | |
| pack-priv boolean | |
| pack-priv abstract boolean | |
| pack-priv static StrongInternPool | |
| pack-priv static StrongInternPool | |
| pack-priv static StrongInternPool | |
| pack-priv static StrongInternPool | |
| pack-priv static StrongInternPool | |
| pack-priv static StrongInternPool | |
| pack-priv static StrongInternPool | |
| pack-priv int | |
| pack-priv abstract int | |
| private static int | |
| public StrongInternPool | |
| private void | |
| public E | Returns: the one true unique object (equal toentry)the object to internalize entry)Internalizes the specified object by always returning the first ever stored. |
| public boolean | |
| public Iterator | |
| private static <K> K | |
| pack-priv boolean | |
| private int | |
| private int | |
| public void | |
| private void | |
| private void | |
| private void | |
| public boolean | |
| private void | |
| public int | |
| public Object[] | Returns: an array containing elements in this set along with randomly placed nulls,Advanced method that returns the internal table. |
| public String | |
| private static <K> K | |
| private void |
| DEFAULT_CAPACITY | back to summary |
|---|---|
| private static final int DEFAULT_CAPACITY Same default as HashMap, must be a power of 2 | |
| DEFAULT_LOAD_FACTOR | back to summary |
|---|---|
| private static final float DEFAULT_LOAD_FACTOR 67%, just like IdentityHashMap | |
| elementType | back to summary |
|---|---|
| private final Class<E> elementType The class of values that may be present in | |
| index | back to summary |
|---|---|
| private transient StrongInternPool<E>. Cache for an index | |
| loadFactor | back to summary |
|---|---|
| private final float loadFactor The user defined load factor which defines when to resize | |
| MAXIMUM_CAPACITY | back to summary |
|---|---|
| private static final int MAXIMUM_CAPACITY MAX_INT - 1 | |
| modCount | back to summary |
|---|---|
| private transient int modCount Counter used to detect changes made outside of an iterator | |
| NULL | back to summary |
|---|---|
| private static final Object NULL Marks null keys. | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Serialization ID | |
| size | back to summary |
|---|---|
| private transient int size The current number of key-value pairs | |
| table | back to summary |
|---|---|
| private transient Object[] table The open-addressed table
Must be | |
| threshold | back to summary |
|---|---|
| private transient int threshold The next resize | |
| StrongInternPool | back to summary |
|---|---|
| pack-priv StrongInternPool(Class<E> elementType, int initialCapacity, float loadFactor) | |
| StrongInternPool | back to summary |
|---|---|
| pack-priv StrongInternPool(Class<E> elementType, int initialCapacity) | |
| StrongInternPool | back to summary |
|---|---|
| pack-priv StrongInternPool(Class<E> elementType) | |
| clear | back to summary |
|---|---|
| public void clear() | |
| clone | back to summary |
|---|---|
| public StrongInternPool Overrides java. Doc from java. Creates and returns a copy of this object. The precise meaning
of "copy" may depend on the class of the object. The general
intent is that, for any object will be true, and that the expression:x.clone() != x will bex.clone().getClass() == x.getClass() true, but these are not absolute requirements.
While it is typically the case that:
will bex.clone().equals(x) true, this is not an absolute requirement.
By convention, the returned object should be obtained by calling
By convention, the object returned by this method should be independent
of this object (which is being cloned). To achieve this independence,
it may be necessary to modify one or more fields of the object returned
by
| |
| contains | back to summary |
|---|---|
| public boolean contains(Object entry) | |
| eq | back to summary |
|---|---|
pack-priv boolean eq(Object o1, Object o2)
| |
| equality | back to summary |
|---|---|
| pack-priv abstract boolean equality(E o1, E o2) | |
| forByteArrays | back to summary |
|---|---|
| pack-priv static StrongInternPool | |
| forFields | back to summary |
|---|---|
| pack-priv static StrongInternPool | |
| forMethods | back to summary |
|---|---|
| pack-priv static StrongInternPool | |
| forRecordComponents | back to summary |
|---|---|
| pack-priv static StrongInternPool | |
| forStrings | back to summary |
|---|---|
| pack-priv static StrongInternPool | |
| forTypeArrays | back to summary |
|---|---|
| pack-priv static StrongInternPool | |
| forTypes | back to summary |
|---|---|
| pack-priv static StrongInternPool | |
| hash | back to summary |
|---|---|
pack-priv int hash(Object o)
| |
| hashCode | back to summary |
|---|---|
| pack-priv abstract int hashCode(E o) | |
| index | back to summary |
|---|---|
| private static int index(int hashCode, int length) | |
| index | back to summary |
|---|---|
| public StrongInternPool | |
| init | back to summary |
|---|---|
| private void init(int initialCapacity, float loadFactor) | |
| intern | back to summary |
|---|---|
| public E intern(E entry) Internalizes the specified object by always returning the first ever stored. Equal objects with different identity (aka duplicates) can be eliminated with this method.
| |
| isEmpty | back to summary |
|---|---|
| public boolean isEmpty() | |
| iterator | back to summary |
|---|---|
| public Iterator | |
| maskNull | back to summary |
|---|---|
private static <K> K maskNull(K key)
| |
| mayContain | back to summary |
|---|---|
| pack-priv boolean mayContain(Object o) | |
| nextIndex | back to summary |
|---|---|
| private int nextIndex(int index, int length) | |
| offset | back to summary |
|---|---|
| private int offset(Object entry) | |
| printDebugStats | back to summary |
|---|---|
| public void printDebugStats() | |
| putForCreate | back to summary |
|---|---|
| private void putForCreate(E entry) | |
| readObject | back to summary |
|---|---|
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException
| |
| relocate | back to summary |
|---|---|
| private void relocate(int start) | |
| remove | back to summary |
|---|---|
| public boolean remove(Object o) | |
| resize | back to summary |
|---|---|
| private void resize(int from) | |
| size | back to summary |
|---|---|
| public int size() | |
| toInternalArray | back to summary |
|---|---|
| public Object[] toInternalArray() Advanced method that returns the internal table. The resulting array will contain nulls at random places that must be skipped. In addition, it will not operate correctly if a null was inserted into the set. Use at your own risk....
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
| |
| unmaskNull | back to summary |
|---|---|
| private static <K> K unmaskNull(K key) | |
| writeObject | back to summary |
|---|---|
| private void writeObject(ObjectOutputStream s) throws IOException | |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv boolean | |
| pack-priv int |
| ByteArrayInternPool | back to summary |
|---|---|
| pack-priv ByteArrayInternPool() | |
| equality | back to summary |
|---|---|
| pack-priv boolean equality(byte[] o1, byte[] o2) Implements abstract org.
| |
| hashCode | back to summary |
|---|---|
| pack-priv int hashCode(byte[] o) Implements abstract org.
| |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv boolean | equality(FieldInternal o1, FieldInternal o2)
Implements abstract org. |
| pack-priv int |
| FieldInternPool | back to summary |
|---|---|
| public FieldInternPool() | |
| equality | back to summary |
|---|---|
| pack-priv boolean equality(FieldInternal o1, FieldInternal o2) Implements abstract org.
| |
| hashCode | back to summary |
|---|---|
| pack-priv int hashCode(FieldInternal o) Implements abstract org.
| |
| Modifier and Type | Field and Description |
|---|---|
| private int | |
| private int | |
| private boolean | |
| private int | |
| pack-priv Object[] |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | |
| public E | |
| public void | remove()
Overrides default java. |
| current | back to summary |
|---|---|
| private int current | |
| expectedCount | back to summary |
|---|---|
| private int expectedCount | |
| hasNext | back to summary |
|---|---|
| private boolean hasNext | |
| next | back to summary |
|---|---|
| private int next | |
| table | back to summary |
|---|---|
| pack-priv Object[] table | |
| IdentityHashSetIterator | back to summary |
|---|---|
| private IdentityHashSetIterator() | |
| hasNext | back to summary |
|---|---|
| public boolean hasNext() Implements java. Doc from java. Returns
| |
| next | back to summary |
|---|---|
| public E next() Implements java. Doc from java. Returns the next element in the iteration.
| |
| remove | back to summary |
|---|---|
| public void remove() Overrides default java. Doc from java. Removes from the underlying collection the last element returned
by this iterator (optional operation). This method can be called
only once per call to The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.
The behavior of an iterator is unspecified if this method is called
after a call to the | |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public int | Returns: 1-based position ofe in the table, or -1 if it is not presentthe entry to find in the table e)Returns a 1-based position of given entry in the table. |
| modCount | back to summary |
|---|---|
| private int modCount | |
| offsets | back to summary |
|---|---|
| private int[] offsets | |
| Index | back to summary |
|---|---|
| pack-priv Index() | |
| positionOf | back to summary |
|---|---|
| public int positionOf(E e) Returns a 1-based position of given entry in the table. Returns -1 if the entry is not present in the table. This indeed means that this method never returns 0.
| |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv boolean | equality(MethodInternal o1, MethodInternal o2)
Implements abstract org. |
| pack-priv int |
| MethodInternPool | back to summary |
|---|---|
| public MethodInternPool() | |
| equality | back to summary |
|---|---|
| pack-priv boolean equality(MethodInternal o1, MethodInternal o2) Implements abstract org.
| |
| hashCode | back to summary |
|---|---|
| pack-priv int hashCode(MethodInternal o) Implements abstract org.
| |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv boolean | equality(RecordComponentInternal o1, RecordComponentInternal o2)
Implements abstract org. |
| pack-priv int |
| RecordComponentInternPool | back to summary |
|---|---|
| public RecordComponentInternPool() | |
| equality | back to summary |
|---|---|
| pack-priv boolean equality(RecordComponentInternal o1, RecordComponentInternal o2) Implements abstract org.
| |
| hashCode | back to summary |
|---|---|
| pack-priv int hashCode(RecordComponentInternal o) Implements abstract org.
| |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv boolean | |
| pack-priv int |
| StringInternPool | back to summary |
|---|---|
| public StringInternPool() | |
| equality | back to summary |
|---|---|
| pack-priv boolean equality(String o1, String o2) Implements abstract org.
| |
| hashCode | back to summary |
|---|---|
| pack-priv int hashCode(String o) Implements abstract org.
| |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv boolean | |
| pack-priv int |
| TypeArrayInternPool | back to summary |
|---|---|
| public TypeArrayInternPool() | |
| equality | back to summary |
|---|---|
| pack-priv boolean equality(Type[] o1, Type[] o2) Implements abstract org.
| |
| hashCode | back to summary |
|---|---|
| pack-priv int hashCode(Type[] o) Implements abstract org.
| |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv boolean | |
| pack-priv int |
| TypeInternPool | back to summary |
|---|---|
| public TypeInternPool() | |
| equality | back to summary |
|---|---|
| pack-priv boolean equality(Type o1, Type o2) Implements abstract org.
| |
| hashCode | back to summary |
|---|---|
| pack-priv int hashCode(Type o) Implements abstract org.
| |