|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.hadoop.hdfs.util.LightWeightHashSet<T>
org.apache.hadoop.hdfs.util.LightWeightLinkedSet<T>
public class LightWeightLinkedSet<T>
A low memory linked hash set implementation, which uses an array for storing the elements and linked lists for collision resolution. In addition it stores elements in a linked list to ensure ordered traversal. This class does not support null element. This class is not thread safe.
| Field Summary |
|---|
| Fields inherited from class org.apache.hadoop.hdfs.util.LightWeightHashSet |
|---|
DEFAULT_MAX_LOAD_FACTOR, DEFAUT_MIN_LOAD_FACTOR, entries, MINIMUM_CAPACITY, modification, size |
| Constructor Summary | |
|---|---|
LightWeightLinkedSet()
|
|
LightWeightLinkedSet(int initCapacity,
float maxLoadFactor,
float minLoadFactor)
|
|
| Method Summary | ||
|---|---|---|
protected boolean |
addElem(T element)
Add given element to the hash table |
|
void |
clear()
Clear the set. |
|
Iterator<T> |
iterator()
|
|
List<T> |
pollAll()
Remove all elements from the set and return them in order. |
|
T |
pollFirst()
Remove and return first element on the linked list of all elements. |
|
List<T> |
pollN(int n)
Remove and return n elements from the hashtable. |
|
protected org.apache.hadoop.hdfs.util.LightWeightLinkedSet.DoubleLinkedElement<T> |
removeElem(T key)
Remove the element corresponding to the key, given key.hashCode() == index. |
|
|
toArray(U[] a)
|
|
| Methods inherited from class org.apache.hadoop.hdfs.util.LightWeightHashSet |
|---|
add, addAll, contains, containsAll, expandIfNecessary, getCapacity, getContainedElem, getElement, getIndex, isEmpty, pollToArray, printDetails, remove, removeAll, retainAll, shrinkIfNecessary, size, toArray, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Collection |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public LightWeightLinkedSet(int initCapacity,
float maxLoadFactor,
float minLoadFactor)
initCapacity - Recommended size of the internal array.maxLoadFactor - used to determine when to expand the internal arrayminLoadFactor - used to determine when to shrink the internal arraypublic LightWeightLinkedSet()
| Method Detail |
|---|
protected boolean addElem(T element)
addElem in class LightWeightHashSet<T>protected org.apache.hadoop.hdfs.util.LightWeightLinkedSet.DoubleLinkedElement<T> removeElem(T key)
removeElem in class LightWeightHashSet<T>public T pollFirst()
public List<T> pollN(int n)
pollN in class LightWeightHashSet<T>public List<T> pollAll()
pollAll in class LightWeightHashSet<T>public <U> U[] toArray(U[] a)
toArray in interface Collection<T>toArray in class LightWeightHashSet<T>public Iterator<T> iterator()
iterator in interface Iterable<T>iterator in interface Collection<T>iterator in class LightWeightHashSet<T>public void clear()
clear in interface Collection<T>clear in class LightWeightHashSet<T>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||