K
- Key type for looking up the elementsE
- Element type, which must be
(1) a subclass of K, and
(2) implementing LightWeightGSet.LinkedElement
interface.public class LightWeightGSet<K,E extends K> extends Object implements GSet<K,E>
GSet
implementation,
which uses an array for storing the elements
and linked lists for collision resolution.
No rehash will be performed.
Therefore, the internal array will never be resized.
This class does not support null element.
This class is not thread safe.限定符和类型 | 类和说明 |
---|---|
static interface |
LightWeightGSet.LinkedElement
Elements of
LightWeightGSet . |
限定符和类型 | 字段和说明 |
---|---|
static org.apache.commons.logging.Log |
LOG |
构造器和说明 |
---|
LightWeightGSet(int recommended_length) |
限定符和类型 | 方法和说明 |
---|---|
void |
clear() |
static int |
computeCapacity(double percentage,
String mapName)
Let t = percentage of max memory.
|
boolean |
contains(K key)
Does this set contain an element corresponding to the given key?
|
E |
get(K key)
Return the stored element which is equal to the given key.
|
Iterator<E> |
iterator() |
void |
printDetails(PrintStream out)
Print detailed information of this object.
|
E |
put(E element)
Add/replace an element.
|
E |
remove(K key)
Remove the element corresponding to the given key.
|
int |
size() |
String |
toString() |
public LightWeightGSet(int recommended_length)
recommended_length
- Recommended size of the internal array.public E get(K key)
GSet
Map.get(Object)
.public boolean contains(K key)
GSet
public E put(E element)
GSet
Map.put(Object, Object)
but is different from Set.add(Object)
which does not replace the existing element if there is any.public E remove(K key)
GSet
Map.remove(Object)
.public void printDetails(PrintStream out)
public static int computeCapacity(double percentage, String mapName)
Copyright © 2009 The Apache Software Foundation