- java.lang.Object
-
- swim.collections.BTreeContext<K,V>
-
- swim.collections.BTree<K,V>
-
- All Implemented Interfaces:
Iterable<Map.Entry<K,V>>,Map<K,V>,SortedMap<K,V>,Debug,IterableMap<K,V>,OrderedMap<K,V>
public class BTree<K,V> extends BTreeContext<K,V> implements OrderedMap<K,V>, Debug
ImmutableOrderedMapbacked by a B-tree.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()BTree<K,V>cleared()Comparator<? super K>comparator()booleancontainsKey(Object key)booleancontainsValue(Object value)protected BTree<K,V>copy(BTreePage<K,V,?> root)voiddebug(Output<?> output)Writes a developer readable, debug-formatted string representation of this object tooutput.BTree<K,V>drop(int lower)static <K,V>
BTree<K,V>empty()booleanequals(Object other)Map.Entry<K,V>firstEntry()KfirstKey()VfirstValue()static <K,V>
BTree<K,V>from(Map<? extends K,? extends V> map)Vget(Object key)Map.Entry<K,V>getEntry(Object key)Map.Entry<K,V>getIndex(int index)inthashCode()intindexOf(Object key)booleanisEmpty()OrderedMapCursor<K,V>iterator()Cursor<K>keyIterator()Map.Entry<K,V>lastEntry()OrderedMapCursor<K,V>lastIterator()KlastKey()Cursor<K>lastKeyIterator()VlastValue()Cursor<V>lastValueIterator()Map.Entry<K,V>nextEntry(K key)KnextKey(K key)VnextValue(K key)static <K,V>
BTree<K,V>of(K key, V value)Map.Entry<K,V>previousEntry(K key)KpreviousKey(K key)VpreviousValue(K key)Vput(K key, V newValue)voidputAll(Map<? extends K,? extends V> map)Vremove(Object key)BTree<K,V>removed(K key)intsize()BTree<K,V>take(int upper)StringtoString()BTree<K,V>updated(K key, V newValue)Cursor<V>valueIterator()-
Methods inherited from class swim.collections.BTreeContext
compareKey, pageShouldMerge, pageShouldSplit, pageSplitSize
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
-
-
Method Detail
-
empty
public static <K,V> BTree<K,V> empty()
-
of
public static <K,V> BTree<K,V> of(K key, V value)
-
isEmpty
public boolean isEmpty()
-
size
public int size()
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKeyin interfaceIterableMap<K,V>- Specified by:
containsKeyin interfaceMap<K,V>- Specified by:
containsKeyin interfaceOrderedMap<K,V>
-
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValuein interfaceIterableMap<K,V>- Specified by:
containsValuein interfaceMap<K,V>- Specified by:
containsValuein interfaceOrderedMap<K,V>
-
indexOf
public int indexOf(Object key)
- Specified by:
indexOfin interfaceOrderedMap<K,V>
-
getEntry
public Map.Entry<K,V> getEntry(Object key)
- Specified by:
getEntryin interfaceOrderedMap<K,V>
-
getIndex
public Map.Entry<K,V> getIndex(int index)
- Specified by:
getIndexin interfaceOrderedMap<K,V>
-
firstEntry
public Map.Entry<K,V> firstEntry()
- Specified by:
firstEntryin interfaceOrderedMap<K,V>
-
firstKey
public K firstKey()
-
firstValue
public V firstValue()
- Specified by:
firstValuein interfaceOrderedMap<K,V>
-
lastKey
public K lastKey()
-
lastValue
public V lastValue()
- Specified by:
lastValuein interfaceOrderedMap<K,V>
-
nextEntry
public Map.Entry<K,V> nextEntry(K key)
- Specified by:
nextEntryin interfaceOrderedMap<K,V>
-
previousEntry
public Map.Entry<K,V> previousEntry(K key)
- Specified by:
previousEntryin interfaceOrderedMap<K,V>
-
previousKey
public K previousKey(K key)
- Specified by:
previousKeyin interfaceOrderedMap<K,V>
-
previousValue
public V previousValue(K key)
- Specified by:
previousValuein interfaceOrderedMap<K,V>
-
clear
public void clear()
-
iterator
public OrderedMapCursor<K,V> iterator()
-
keyIterator
public Cursor<K> keyIterator()
- Specified by:
keyIteratorin interfaceIterableMap<K,V>- Specified by:
keyIteratorin interfaceOrderedMap<K,V>
-
valueIterator
public Cursor<V> valueIterator()
- Specified by:
valueIteratorin interfaceIterableMap<K,V>- Specified by:
valueIteratorin interfaceOrderedMap<K,V>
-
lastIterator
public OrderedMapCursor<K,V> lastIterator()
-
comparator
public Comparator<? super K> comparator()
- Specified by:
comparatorin interfaceOrderedMap<K,V>- Specified by:
comparatorin interfaceSortedMap<K,V>
-
equals
public boolean equals(Object other)
-
hashCode
public int hashCode()
-
debug
public void debug(Output<?> output)
Description copied from interface:DebugWrites a developer readable, debug-formatted string representation of this object tooutput.
-
-