public class FixedCapacityIntByteMinHeap extends Object implements Int2ByteMapEntryIterable
| Constructor and Description | 
|---|
| FixedCapacityIntByteMinHeap(int capacity)Initialize the heap with desired capacity | 
| Modifier and Type | Method and Description | 
|---|---|
| void | add(int key,
   byte value)Add a key value pair | 
| void | clear()Clear the heap | 
| protected int | compare(int key1,
       byte value1,
       int key2,
       byte value2)Comapre two (key, value) entries | 
| void | forEachIntByte(IntByteConsumer f)Traverse all elements of the heap, calling given function on each element. | 
| boolean | forEachWhileIntByte(IntBytePredicate f)Traverse all elements of the heap, calling given function on each element,
 or until predicate returns false. | 
| int | getCapacity()Get capacity of the heap | 
| int | getMinKey() | 
| byte | getMinValue() | 
| boolean | isEmpty()Check if the heap is empty | 
| it.unimi.dsi.fastutil.objects.ObjectIterator<it.unimi.dsi.fastutil.ints.Int2ByteMap.Entry> | iterator()Get the iterator. | 
| static FixedCapacityIntByteMinHeap | read(FixedCapacityIntByteMinHeap heap,
    DataInput in)Deserializes an object from data input. | 
| void | removeMin()Removes the (key, value) pair that corresponds to the minimum value
 currently in the heap. | 
| int | size()Get the size of this iterable | 
| static void | write(FixedCapacityIntByteMinHeap heap,
     DataOutput out)Serializes an object into data output. | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic FixedCapacityIntByteMinHeap(int capacity)
capacity - Capacitypublic void clear()
public void add(int key,
                byte value)
key - Keyvalue - Valuepublic int getMinKey()
NoSuchElementException - if the heap is empty.public byte getMinValue()
NoSuchElementException - if the heap is empty.public void removeMin()
protected int compare(int key1,
                      byte value1,
                      int key2,
                      byte value2)
key1 - First keyvalue1 - First valuekey2 - Second keyvalue2 - Second valuepublic it.unimi.dsi.fastutil.objects.ObjectIterator<it.unimi.dsi.fastutil.ints.Int2ByteMap.Entry> iterator()
Int2ByteMapEntryIterableiterator in interface it.unimi.dsi.fastutil.objects.ObjectIterable<it.unimi.dsi.fastutil.ints.Int2ByteMap.Entry>iterator in interface Iterable<it.unimi.dsi.fastutil.ints.Int2ByteMap.Entry>iterator in interface Int2ByteMapEntryIterablepublic int size()
Int2ByteMapEntryIterablesize in interface Int2ByteMapEntryIterablepublic boolean isEmpty()
public int getCapacity()
public static void write(FixedCapacityIntByteMinHeap heap, DataOutput out) throws IOException
heap - Object instance to serializeout - Data outputIOExceptionpublic static FixedCapacityIntByteMinHeap read(FixedCapacityIntByteMinHeap heap, DataInput in) throws IOException
heap - Object to reuse if possiblein - Data inputIOExceptionpublic void forEachIntByte(IntByteConsumer f)
f - Function to call on each element.public boolean forEachWhileIntByte(IntBytePredicate f)
f - Function to call on each element.Copyright © 2011-2020 The Apache Software Foundation. All Rights Reserved.