Package org.apache.hadoop.ozone.om
Class ListIterator.MinHeapIterator
java.lang.Object
org.apache.hadoop.ozone.om.ListIterator.MinHeapIterator
- All Implemented Interfaces:
Closeable,AutoCloseable,Iterator<ListIterator.HeapEntry>,ListIterator.ClosableIterator
- Enclosing class:
ListIterator
public static class ListIterator.MinHeapIterator
extends Object
implements ListIterator.ClosableIterator
Implement lexicographical sorting of the file status by sorting file status
across multiple lists. Each of these lists are sorted internally.
This class implements sorted output by implementing a min heap based
iterator where the initial element from each of sorted list is inserted.
The least entry is removed and the next entry from the same list from
which the entry is removed is added into the list.
For example
RawDir - a1, a3, a5, a7
RawFile - a2, a4, a6, a8
Min Heap is initially composed of {(a1, RawDir), (a2, RawFile)}
The least element is removed i.e a1 and then next entry from RawDir
is inserted into minheap resulting in {(a2, RawFile), (a3, RawDir)}
This process is repeated till both the lists are exhausted.
-
Method Details
-
hasNext
public boolean hasNext()- Specified by:
hasNextin interfaceIterator<ListIterator.HeapEntry>
-
next
- Specified by:
nextin interfaceIterator<ListIterator.HeapEntry>
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-