|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractSet
dsto.dfc.collections.IdentityHashSet
public class IdentityHashSet
Exactly like HashSet except uses an IdentityHashMap as backing, thus comparing objects using == instead of equals ().
| Constructor Summary | |
|---|---|
IdentityHashSet()
Constructs a new, empty set; the backing IdentityHashMap instance has default capacity and load factor, which is 0.75. |
|
IdentityHashSet(Collection c)
Constructs a new set containing the elements in the specified collection. |
|
IdentityHashSet(int initialCapacity)
Constructs a new, empty set; the backing IdentityHashMap instance has the specified initial capacity and default load factor, which is 0.75. |
|
IdentityHashSet(int initialCapacity,
float loadFactor)
Constructs a new, empty set; the backing IdentityHashMap instance has the specified initial capacity and the specified load factor. |
|
| Method Summary | |
|---|---|
boolean |
add(Object o)
Adds the specified element to this set if it is not already present. |
void |
clear()
Removes all of the elements from this set. |
Object |
clone()
Returns a shallow copy of this identityHashSet instance: the elements themselves are not cloned. |
boolean |
contains(Object o)
Returns true if this set contains the specified element. |
boolean |
isEmpty()
Returns true if this set contains no elements. |
Iterator |
iterator()
Returns an iterator over the elements in this set. |
boolean |
remove(Object o)
Removes the given element from this set if it is present. |
int |
size()
Returns the number of elements in this set (its cardinality). |
| Methods inherited from class java.util.AbstractSet |
|---|
equals, hashCode, removeAll |
| Methods inherited from class java.util.AbstractCollection |
|---|
addAll, containsAll, retainAll, toArray, toArray, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Set |
|---|
addAll, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray |
| Constructor Detail |
|---|
public IdentityHashSet()
public IdentityHashSet(Collection c)
c - the collection whose elements are to be placed into this set.
public IdentityHashSet(int initialCapacity,
float loadFactor)
initialCapacity - the initial capacity of the hash map.loadFactor - the load factor of the hash map.
IllegalArgumentException - if the initial capacity is less
than zero, or if the load factor is nonpositive.public IdentityHashSet(int initialCapacity)
initialCapacity - the initial capacity of the hash table.
IllegalArgumentException - if the initial capacity is less
than zero.| Method Detail |
|---|
public Iterator iterator()
iterator in interface Iterableiterator in interface Collectioniterator in interface Setiterator in class AbstractCollectionpublic int size()
size in interface Collectionsize in interface Setsize in class AbstractCollectionpublic boolean isEmpty()
isEmpty in interface CollectionisEmpty in interface SetisEmpty in class AbstractCollectionpublic boolean contains(Object o)
contains in interface Collectioncontains in interface Setcontains in class AbstractCollectiono - element whose presence in this set is to be tested.
public boolean add(Object o)
add in interface Collectionadd in interface Setadd in class AbstractCollectiono - element to be added to this set.
public boolean remove(Object o)
remove in interface Collectionremove in interface Setremove in class AbstractCollectiono - object to be removed from this set, if present.
public void clear()
clear in interface Collectionclear in interface Setclear in class AbstractCollectionpublic Object clone()
clone in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||