java.lang.Object
io.helidon.grpc.core.PriorityBag<T>
- Type Parameters:
- T- the type of elements in the bag
- All Implemented Interfaces:
- Iterable<T>
A bag of values ordered by priority.
 
An element with lower priority number is more significant than an element with a higher priority number.
For cases where priority is the same, elements are ordered in the order that they were added to the bag.
Elements added with negative priorities are assumed to have no priority and will be least significant in order.
- 
Method SummaryModifier and TypeMethodDescriptionvoidAdd an element to the bag.voidAdd an element to the bag with a specific priority.voidAdd elements to the bag.voidAdd elements to the bag.copyMe()Obtain a copy of thisPriorityBag.static <T> PriorityBag<T>create()Create a newPriorityBagwhere elements added with no priority will be last in the order.iterator()voidmerge(PriorityBag<? extends T> bag) Merge aPriorityBaginto thisPriorityBag.readOnly()Obtain an immutable copy of thisPriorityBag.stream()Obtain the contents of thisPriorityBagas an orderedStream.static <T> PriorityBag<T>withDefaultPriority(int priority) Create a newPriorityBagwhere elements added with no priority will be be given a default priority value.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.IterableforEach, spliterator
- 
Method Details- 
createCreate a newPriorityBagwhere elements added with no priority will be last in the order.- Type Parameters:
- T- the type of elements in the bag
- Returns:
- a new PriorityBagwhere elements dded with no priority will be last in the order
 
- 
withDefaultPriorityCreate a newPriorityBagwhere elements added with no priority will be be given a default priority value.- Type Parameters:
- T- the type of elements in the bag
- Parameters:
- priority- the default priority value to assign to elements added with no priority
- Returns:
- a new PriorityBagwhere elements added with no priority will be be given a default priority value
 
- 
copyMeObtain a copy of thisPriorityBag.- Returns:
- a copy of this PriorityBag
 
- 
readOnlyObtain an immutable copy of thisPriorityBag.- Returns:
- an immutable copy of this PriorityBag
 
- 
mergeMerge aPriorityBaginto thisPriorityBag.- Parameters:
- bag- the bag to merge
 
- 
addAllAdd elements to the bag.If the element's class is annotated with the Priorityannotation then that value will be used to determine priority otherwise the default priority value will be used.- Parameters:
- values- the elements to add
 
- 
addAllAdd elements to the bag.- Parameters:
- values- the elements to add
- priority- the priority to assign to the elements
 
- 
addAdd an element to the bag.If the element's class is annotated with the Priorityannotation then that value will be used to determine priority otherwise the default priority value will be used.- Parameters:
- value- the element to add
 
- 
addAdd an element to the bag with a specific priority.- Parameters:
- value- the element to add
- priority- the priority of the element
 
- 
streamObtain the contents of thisPriorityBagas an orderedStream.- Returns:
- the contents of this PriorityBagas an orderedStream
 
- 
iterator
 
-