Package net.metanotion.util.skiplist
Class SkipList<K extends Comparable<? super K>,V>
java.lang.Object
net.metanotion.util.skiplist.SkipList<K,V>
- Direct Known Subclasses:
BSkipList
public class SkipList<K extends Comparable<? super K>,V> extends Object implements Flushable, Iterable<V>
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description voidaddItem()voidbalance()voiddelItem()SkipIterator<K,V>find(K key)voidflush()intgenerateColHeight()Vget(K key)SkipIterator<K,V>iterator()intmaxLevels()voidprint()Deprecated.goes to System.outvoidprintSL()Deprecated.goes to System.outvoidput(K key, V val)Vremove(K key)intsize()
-
Field Details
-
Constructor Details
-
Method Details
-
flush
public void flush() -
size
public int size() -
addItem
public void addItem() -
delItem
public void delItem() -
maxLevels
public int maxLevels()- Returns:
- 4 since we don't track span count here any more - see override Fix if for some reason you want a huge in-memory skiplist.
-
generateColHeight
public int generateColHeight()- Returns:
- 0..maxLevels(), each successive one with probability 1 / P
-
put
-
remove
-
printSL
Deprecated.goes to System.outdumps all the skip levels -
print
Deprecated.goes to System.outdumps all the data -
get
-
iterator
- Specified by:
iteratorin interfaceIterable<K extends Comparable<? super K>>
-
find
- Returns:
- an iterator where nextKey() is the first one greater than or equal to 'key'
-
balance
public void balance()
-