Package sc.util
Class CoalescedHashSet<T>
- java.lang.Object
-
- sc.util.CoalescedHashSet<T>
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,ISet<T>
public class CoalescedHashSet<T> extends java.lang.Object implements java.lang.Cloneable, java.io.Serializable, ISet<T>
This is a faster implementation of the basic operations for a table whose size is known roughly before populating, elements are never removed, hash functions are relatively good. No hash-table entries are created for adding a new item. Items are put into a slot based on their hash code. If that spot is filled, we start at the top of the list and put it in the first entry spot. So a full list can have O(N) insert and O(N) lookup. Resizing is expensive so avoid that.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CoalescedHashSet(int sz)
CoalescedHashSet(T[] elements)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(T obj)
void
addAll(ISet<T> s)
boolean
contains(T obj)
boolean
containsAny(ISet<T> other)
java.util.Iterator<T>
iterator()
int
size()
-