com.sleepycat.je.utilint
Class TinyHashSet<T>

java.lang.Object
  extended by com.sleepycat.je.utilint.TinyHashSet<T>

public class TinyHashSet<T>
extends java.lang.Object

TinyHashSet is used to optimize (for speed, not space) the case where a HashSet generally holds a single element. This saves us the cost of creating the HashSet and related elements as well as call Object.hashCode(). If single != null, it's the only element in the TinyHashSet. If set != null then there are multiple elements in the TinyHashSet. It should never be true that (single != null) && (set != null).


Nested Class Summary
static class TinyHashSet.SingleElementIterator<T>
           
 
Constructor Summary
TinyHashSet()
           
 
Method Summary
 boolean add(T o)
           
 java.util.Set<T> copy()
           
 java.util.Iterator<T> iterator()
           
 boolean remove(T o)
           
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TinyHashSet

public TinyHashSet()
Method Detail

size

public int size()

remove

public boolean remove(T o)

add

public boolean add(T o)

copy

public java.util.Set<T> copy()

iterator

public java.util.Iterator<T> iterator()