E - the element typeclass IdentityHashSet<E>
extends java.util.AbstractSet<E>
implements java.util.Set<E>, java.lang.Cloneable, java.io.Serializable
| Modifier and Type | Class and Description |
|---|---|
private class |
IdentityHashSet.IdentityHashSetIterator |
| Modifier and Type | Field and Description |
|---|---|
private static int |
DEFAULT_CAPACITY
Same default as HashMap, must be a power of 2
|
private static float |
DEFAULT_LOAD_FACTOR
67%, just like IdentityHashMap
|
private float |
loadFactor
The user defined load factor which defines when to resize
|
private static int |
MAXIMUM_CAPACITY
MAX_INT - 1
|
private int |
modCount
Counter used to detect changes made outside of an iterator
|
private static long |
serialVersionUID
Serialization ID
|
private int |
size
The current number of key-value pairs
|
private java.lang.Object[] |
table
The open-addressed table
|
private int |
threshold
The next resize
|
| Constructor and Description |
|---|
IdentityHashSet() |
IdentityHashSet(int initialCapacity) |
IdentityHashSet(int initialCapacity,
float loadFactor) |
IdentityHashSet(java.util.Set<? extends E> set) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E entry) |
boolean |
addAll(java.util.Collection<? extends E> collection) |
void |
clear() |
IdentityHashSet<E> |
clone() |
boolean |
contains(java.lang.Object entry) |
private static int |
hash(java.lang.Object o) |
private static int |
index(int hashCode,
int length) |
private void |
init(int initialCapacity,
float loadFactor) |
boolean |
isEmpty() |
java.util.Iterator<E> |
iterator() |
private int |
nextIndex(int index,
int length) |
void |
printDebugStats() |
private void |
putForCreate(E entry) |
private void |
readObject(java.io.ObjectInputStream s) |
private void |
relocate(int start) |
boolean |
remove(java.lang.Object o) |
private void |
resize(int from) |
int |
size() |
E[] |
toArray(E[] target,
int offs,
int len)
Warning: this will crap out if the set contains a
null. |
<T> T[] |
toScatteredArray(T[] dummy)
Advanced method that returns a copy of the internal table.
|
private void |
writeObject(java.io.ObjectOutputStream s) |
containsAll, retainAll, toArray, toArray, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitprivate static final long serialVersionUID
private static final int DEFAULT_CAPACITY
private static final int MAXIMUM_CAPACITY
private static final float DEFAULT_LOAD_FACTOR
private transient java.lang.Object[] table
private transient int size
private transient int threshold
private final float loadFactor
private transient int modCount
public IdentityHashSet(int initialCapacity,
float loadFactor)
public IdentityHashSet(java.util.Set<? extends E> set)
public IdentityHashSet(int initialCapacity)
public IdentityHashSet()
private void init(int initialCapacity,
float loadFactor)
private static int hash(java.lang.Object o)
private int nextIndex(int index,
int length)
private static int index(int hashCode,
int length)
public int size()
public boolean isEmpty()
public boolean contains(java.lang.Object entry)
public boolean add(E entry)
private void resize(int from)
public boolean addAll(java.util.Collection<? extends E> collection)
public boolean remove(java.lang.Object o)
private void relocate(int start)
public void clear()
public IdentityHashSet<E> clone()
clone in class java.lang.Objectpublic <T> T[] toScatteredArray(T[] dummy)
dummy - the input arraypublic E[] toArray(E[] target, int offs, int len)
null.target - the target to write tooffs - the offset into the targetlen - the length to writepublic void printDebugStats()
private void readObject(java.io.ObjectInputStream s)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOExceptionjava.lang.ClassNotFoundExceptionprivate void putForCreate(E entry)
private void writeObject(java.io.ObjectOutputStream s)
throws java.io.IOException
java.io.IOException