com.threerings.util
Class AbstractIdentityHashSet<T>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<T>
com.threerings.util.AbstractIdentityHashSet<T>
- All Implemented Interfaces:
- Iterable<T>, Collection<T>, Set<T>
- Direct Known Subclasses:
- SceneInfluenceSet, ViewerEffectSet
public abstract class AbstractIdentityHashSet<T>
- extends AbstractSet<T>
Wraps up an IdentityHashMap to look like a set for the purpose of subclassing.
IdentityHashMap has the desirable property of not generating extra objects when elements
are added/removed, because it stores the elements directly in its bucket array (resolving
collisions using linear probing). Note that if you don't need to subclass the set,
then you can just pass an IdentityHashMap to Sets.newSetFromMap(java.util.Map).
AbstractIdentityHashSet
public AbstractIdentityHashSet()
- Creates a new set with the default expected maximum size.
AbstractIdentityHashSet
public AbstractIdentityHashSet(int expectedMaxSize)
- Creates a new set with the specified expected maximum size.
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>
add
public boolean add(T element)
- 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 object)
- Specified by:
remove in interface Collection<T>- Specified by:
remove in interface Set<T>- Overrides:
remove in class AbstractCollection<T>
contains
public boolean contains(Object object)
- Specified by:
contains in interface Collection<T>- Specified by:
contains in interface Set<T>- Overrides:
contains in class AbstractCollection<T>
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>
Copyright © 2011. All Rights Reserved.