public final class

IdentitySet

extends AbstractSet<E>
implements Set<E>
java.lang.Object
   ↳ java.util.AbstractCollection<E>
     ↳ java.util.AbstractSet<E>
       ↳ com.atlassian.jira.util.collect.IdentitySet<T>

Class Overview

A java.util.Set implementation that considers objects equal if an only if they are the same instance. The equals(Object) and hashCode() methods of the stored objects are ignored.

This implementation uses another Set to store IdentitySet.IdentityReference objects for each object in the set.

Summary

Nested Classes
class IdentitySet.IdentityReference<T> Stores a reference to any Object. 
Public Constructors
IdentitySet(Set<IdentityReference<T>> delegateSet)
Create a new set using the passed set as the store.
Public Methods
boolean add(T t)
boolean addAll(Collection<? extends T> c)
void clear()
boolean contains(Object o)
boolean containsAll(Collection<?> c)
boolean isEmpty()
Iterator<T> iterator()
static <T> IdentitySet<T> newListOrderedSet()
Create a new identity set.
static <T> IdentitySet<T> newSet()
Create a new identity set.
boolean remove(Object o)
boolean removeAll(Collection<?> c)
boolean retainAll(Collection<?> c)
int size()
String toString()
[Expand]
Inherited Methods
From class java.util.AbstractSet
From class java.util.AbstractCollection
From class java.lang.Object
From interface java.lang.Iterable
From interface java.util.Collection
From interface java.util.Set

Public Constructors

public IdentitySet (Set<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.

Public Methods

public boolean add (T t)

public boolean addAll (Collection<? extends T> c)

public void clear ()

public boolean contains (Object o)

public boolean containsAll (Collection<?> c)

public boolean isEmpty ()

public Iterator<T> iterator ()

public static IdentitySet<T> newListOrderedSet ()

Create a new identity set. The elements in the returned set will be stored in addition order.

Returns
  • the new set.

public static IdentitySet<T> newSet ()

Create a new identity set.

Returns
  • the new set.

public boolean remove (Object o)

public boolean removeAll (Collection<?> c)

public boolean retainAll (Collection<?> c)

public int size ()

public String toString ()