com.atlassian.jira.util.collect
Class IdentitySet<T>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<T>
com.atlassian.jira.util.collect.IdentitySet<T>
- All Implemented Interfaces:
- Iterable<T>, Collection<T>, Set<T>
public final class IdentitySet<T>
- extends AbstractSet<T>
- implements Set<T>
A Set implementation that considers objects equal if an only if they are the same instance. The
Object.equals(Object) and Object.hashCode() methods of the stored objects are ignored.
This implementation uses another Set to store IdentitySet.IdentityReference
objects for each object in the set.
IdentitySet
public IdentitySet(Set<IdentitySet.IdentityReference<T>> delegateSet)
- Create a new set using the passed set as the store. The passed set should not be used by the caller while the new
IdentitySet is in use.
- Parameters:
delegateSet - the set actually store the objects.
newSet
public static <T> IdentitySet<T> newSet()
- Create a new identity set.
- Type Parameters:
T - the objects to be stored in the identity set.
- Returns:
- the new set.
newListOrderedSet
public static <T> IdentitySet<T> newListOrderedSet()
- Create a new identity set. The elements in the returned set will be stored in addition order.
- Type Parameters:
T - the objects to be stored in the identity set.
- Returns:
- the new set.
clear
public void clear()
- Specified by:
clear in interface Collection<T>- Specified by:
clear in interface Set<T>- Overrides:
clear in class AbstractCollection<T>
iterator
public Iterator<T> iterator()
- Specified by:
iterator in interface Iterable<T>- Specified by:
iterator in interface Collection<T>- Specified by:
iterator in interface Set<T>- Specified by:
iterator in class AbstractCollection<T>
add
public boolean add(T t)
- Specified by:
add in interface Collection<T>- Specified by:
add in interface Set<T>- Overrides:
add in class AbstractCollection<T>
remove
public boolean remove(Object o)
- Specified by:
remove in interface Collection<T>- Specified by:
remove in interface Set<T>- Overrides:
remove in class AbstractCollection<T>
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAll in interface Collection<T>- Specified by:
containsAll in interface Set<T>- Overrides:
containsAll in class AbstractCollection<T>
addAll
public boolean addAll(Collection<? extends T> c)
- Specified by:
addAll in interface Collection<T>- Specified by:
addAll in interface Set<T>- Overrides:
addAll in class AbstractCollection<T>
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAll in interface Collection<T>- Specified by:
retainAll in interface Set<T>- Overrides:
retainAll in class AbstractCollection<T>
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAll in interface Collection<T>- Specified by:
removeAll in interface Set<T>- Overrides:
removeAll in class AbstractSet<T>
size
public int size()
- Specified by:
size in interface Collection<T>- Specified by:
size in interface Set<T>- Specified by:
size in class AbstractCollection<T>
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty in interface Collection<T>- Specified by:
isEmpty in interface Set<T>- Overrides:
isEmpty in class AbstractCollection<T>
contains
public boolean contains(Object o)
- Specified by:
contains in interface Collection<T>- Specified by:
contains in interface Set<T>- Overrides:
contains in class AbstractCollection<T>
toString
public String toString()
- Overrides:
toString in class AbstractCollection<T>
Copyright © 2002-2012 Atlassian. All Rights Reserved.