|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jrockit.mc.flightrecorder.util.PriorityIterator<Type>
public final class PriorityIterator<Type>
interface that takes an array of k iterators and iterates over them in a prioritized order.
The priority order for a given object returned from iterator.next() is determined by a PriorityProvider. Advantages compared to iterating through all iterators and putting the result in a large array and sort it is:
k = number of iterator to prioritize from
n = total number of elements
Uses a priority heap to keep track of what iterator has the current highest value for iterator.next().
Constructor Summary | |
---|---|
PriorityIterator(java.util.List<java.util.Iterator<Type>> iterators,
IPriorityProvider<Type> provider)
|
|
PriorityIterator(java.util.List<java.util.Iterator<Type>> iterators,
java.util.List<IPriorityProvider<Type>> provider)
Constructs a PrioriteryIterator |
Method Summary | |
---|---|
boolean |
hasNext()
Returns true if the iterator has another element. |
Type |
next()
Returns the iterator.next() value from the iterator with the highest priority. |
void |
remove()
Remove is not supported. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PriorityIterator(java.util.List<java.util.Iterator<Type>> iterators, java.util.List<IPriorityProvider<Type>> provider)
iterators
- the iterator to pick values from in a priority waypublic PriorityIterator(java.util.List<java.util.Iterator<Type>> iterators, IPriorityProvider<Type> provider)
Method Detail |
---|
public void remove()
remove
in interface java.util.Iterator<Type>
public boolean hasNext()
hasNext
in interface java.util.Iterator<Type>
public Type next()
next
in interface java.util.Iterator<Type>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |