Skip navigation links
oracle.javatools.db.util
Class IdentitySet<T>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<T>
oracle.javatools.db.util.IdentitySet<T>
- All Implemented Interfaces:
- java.lang.Iterable<T>, java.util.Collection<T>, java.util.Set<T>
-
public class IdentitySet<T>
- extends java.util.AbstractSet<T>
Set for storing objects and testing their equality only using an identity match - i.e. (obj1 == obj2)
. Use only when caching objects in a model where identity equality is specifically required, rather than .equals equality or any of the comparisons available for DBObject and DBObjectID through the other Collection and Map implementation in this package.
For a Map implementation using the same model, simply use IdentityHashMap
which actually backs this implementation.
This Set is not synchronized for a thread safe Set use Collections.synchronizedSet
.
- See Also:
IdentityHashMap
Methods inherited from class java.util.AbstractSet |
equals, hashCode, removeAll |
Methods inherited from class java.util.AbstractCollection |
addAll, containsAll, isEmpty, retainAll, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Set |
addAll, containsAll, isEmpty, retainAll, toArray, toArray |
IdentitySet
public IdentitySet()
iterator
public java.util.Iterator<T> iterator()
-
- Specified by:
iterator
in interface java.lang.Iterable<T>
- Specified by:
iterator
in interface java.util.Collection<T>
- Specified by:
iterator
in interface java.util.Set<T>
- Specified by:
iterator
in class java.util.AbstractCollection<T>
size
public int size()
-
- Specified by:
size
in interface java.util.Collection<T>
- Specified by:
size
in interface java.util.Set<T>
- Specified by:
size
in class java.util.AbstractCollection<T>
add
public boolean add(T e)
-
- Specified by:
add
in interface java.util.Collection<T>
- Specified by:
add
in interface java.util.Set<T>
- Overrides:
add
in class java.util.AbstractCollection<T>
contains
public boolean contains(java.lang.Object o)
-
- Specified by:
contains
in interface java.util.Collection<T>
- Specified by:
contains
in interface java.util.Set<T>
- Overrides:
contains
in class java.util.AbstractCollection<T>
remove
public boolean remove(java.lang.Object o)
-
- Specified by:
remove
in interface java.util.Collection<T>
- Specified by:
remove
in interface java.util.Set<T>
- Overrides:
remove
in class java.util.AbstractCollection<T>
clear
public void clear()
-
- Specified by:
clear
in interface java.util.Collection<T>
- Specified by:
clear
in interface java.util.Set<T>
- Overrides:
clear
in class java.util.AbstractCollection<T>
Skip navigation links
Copyright © 1997, 2012, Oracle. All rights reserved.