com.sleepycat.je.utilint
Class TinyHashSet

java.lang.Object
  extended by com.sleepycat.je.utilint.TinyHashSet

public class TinyHashSet
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
           
 
Constructor Summary
TinyHashSet()
           
 
Method Summary
 boolean add(java.lang.Object o)
           
 java.util.Set copy()
           
 java.util.Iterator iterator()
           
 boolean remove(java.lang.Object 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(java.lang.Object o)

add

public boolean add(java.lang.Object o)

copy

public java.util.Set copy()

iterator

public java.util.Iterator iterator()


Copyright 2004-2006 Sleepycat, Inc. All Rights Reserved.