@Deprecated public final class PriorityQueue<T> extends java.lang.Object implements java.io.Serializable, Ordered<T>
| Modifier and Type | Method and Description |
|---|---|
<R> PriorityQueue<R> |
collect(PartialFunction<? super T,? extends R> partialFunction)
Deprecated.
Collects all elements that are in the domain of the given
partialFunction by mapping the elements to type R. |
static <T> java.util.stream.Collector<T,java.util.ArrayList<T>,PriorityQueue<T>> |
collector()
Deprecated.
Returns a
Collector which may be used in conjunction with
Stream.collect(Collector) to obtain a PriorityQueue<T>. |
java.util.Comparator<T> |
comparator()
Deprecated.
Returns the comparator which defines the order of the elements contained in this collection.
|
Tuple2<T,PriorityQueue<T>> |
dequeue()
Deprecated.
Removes an element from this Queue.
|
Option<Tuple2<T,Q>> |
dequeueOption()
Removes an element from this Queue.
|
PriorityQueue<T> |
distinct()
Deprecated.
Returns a new version of this which contains no duplicates.
|
PriorityQueue<T> |
distinctBy(java.util.Comparator<? super T> comparator)
Deprecated.
Returns a new version of this which contains no duplicates.
|
<U> PriorityQueue<T> |
distinctBy(java.util.function.Function<? super T,? extends U> keyExtractor)
Deprecated.
Returns a new version of this which contains no duplicates.
|
PriorityQueue<T> |
drop(int n)
Deprecated.
Drops the first n elements of this or all elements, if this length < n.
|
PriorityQueue<T> |
dropRight(int n)
Deprecated.
Drops the last n elements of this or all elements, if this length < n.
|
Q |
dropUntil(java.util.function.Predicate<? super T> predicate)
Drops elements until the predicate holds for the current element.
|
PriorityQueue<T> |
dropWhile(java.util.function.Predicate<? super T> predicate)
Deprecated.
Drops elements while the predicate holds for the current element.
|
static <T extends java.lang.Comparable<? super T>> |
empty()
Deprecated.
Returns the empty PriorityQueue.
|
static <T> PriorityQueue<T> |
empty(java.util.Comparator<? super T> comparator)
Deprecated.
|
Q |
enqueue(T... elements)
Enqueues the given elements.
|
PriorityQueue<T> |
enqueue(T element)
Deprecated.
Enqueues a new element.
|
PriorityQueue<T> |
enqueueAll(java.lang.Iterable<? extends T> elements)
Deprecated.
Enqueues the given elements.
|
boolean |
equals(java.lang.Object o)
Deprecated.
In Vavr there are four basic classes of collections:
Seq (sequential elements)
Set (distinct elements)
Map (indexed elements)
Multimap (indexed collections)
Two collection instances of these classes are equal if and only if both collections
belong to the same basic collection class (Seq, Set, Map or Multimap)
contain the same elements
have the same element order, if the collections are of type Seq
Two Map/Multimap elements, resp.
|
static <T> PriorityQueue<T> |
fill(int size,
java.util.function.Supplier<? extends T> supplier)
Deprecated.
|
static <T> PriorityQueue<T> |
fill(int size,
T element)
Deprecated.
|
PriorityQueue<T> |
filter(java.util.function.Predicate<? super T> predicate)
Deprecated.
Returns a new traversable consisting of all elements which satisfy the given predicate.
|
Q |
filterNot(java.util.function.Predicate<? super T> predicate)
Returns a new traversable consisting of all elements which do not satisfy the given predicate.
|
<U> PriorityQueue<U> |
flatMap(java.util.Comparator<U> comparator,
java.util.function.Function<? super T,? extends java.lang.Iterable<? extends U>> mapper)
Deprecated.
|
<U> PriorityQueue<U> |
flatMap(java.util.function.Function<? super T,? extends java.lang.Iterable<? extends U>> mapper)
Deprecated.
FlatMaps this Traversable.
|
<U> U |
foldRight(U zero,
java.util.function.BiFunction<? super T,? super U,? extends U> accumulator)
Deprecated.
Accumulates the elements of this
PriorityQueue by successively calling the given function f from the right,
starting with a value zero of type B. |
<C> Map<C,? extends PriorityQueue<T>> |
groupBy(java.util.function.Function<? super T,? extends C> classifier)
Deprecated.
Groups this elements by classifying the elements.
|
Iterator<? extends PriorityQueue<T>> |
grouped(int size)
Deprecated.
Groups this
Traversable into fixed size blocks. |
boolean |
hasDefiniteSize()
Deprecated.
Checks if this
PriorityQueue is known to have a finite size. |
int |
hashCode()
Deprecated.
Returns the hash code of this collection.
|
T |
head()
Deprecated.
Returns the first element of a non-empty
PriorityQueue. |
PriorityQueue<T> |
init()
Deprecated.
Dual of tail(), returning all elements except the last.
|
Option<Q> |
initOption()
Dual of tailOption(), returning all elements except the last as
Option. |
boolean |
isAsync()
Deprecated.
A
PriorityQueue is computed synchronously. |
boolean |
isEmpty()
Deprecated.
Checks if this Traversable is empty.
|
boolean |
isLazy()
Deprecated.
A
PriorityQueue is computed eagerly. |
boolean |
isOrdered()
Deprecated.
Checks if this Traversable is ordered
|
boolean |
isTraversableAgain()
Deprecated.
Checks if this
PriorityQueue can be repeatedly traversed. |
T |
last()
Deprecated.
Dual of Traversable.head(), returning the last element.
|
int |
length()
Deprecated.
Computes the number of elements of this
PriorityQueue. |
<U> PriorityQueue<U> |
map(java.util.Comparator<U> comparator,
java.util.function.Function<? super T,? extends U> mapper)
Deprecated.
|
<U> PriorityQueue<U> |
map(java.util.function.Function<? super T,? extends U> mapper)
Deprecated.
Maps the elements of this
Traversable to elements of a new type preserving their order, if any. |
PriorityQueue<T> |
merge(PriorityQueue<T> target)
Deprecated.
|
static <T> PriorityQueue<T> |
narrow(PriorityQueue<? extends T> queue)
Deprecated.
Narrows a widened
PriorityQueue<? extends T> to PriorityQueue<T>
by performing a type-safe cast. |
static <T> PriorityQueue<T> |
of(java.util.Comparator<? super T> comparator,
T... elements)
Deprecated.
|
static <T> PriorityQueue<T> |
of(java.util.Comparator<? super T> comparator,
T element)
Deprecated.
|
static <T extends java.lang.Comparable<? super T>> |
of(T... elements)
Deprecated.
|
static <T extends java.lang.Comparable<? super T>> |
of(T element)
Deprecated.
|
static <T> PriorityQueue<T> |
ofAll(java.util.Comparator<? super T> comparator,
java.lang.Iterable<? extends T> elements)
Deprecated.
|
static <T> PriorityQueue<T> |
ofAll(java.util.Comparator<? super T> comparator,
java.util.stream.Stream<? extends T> javaStream)
Deprecated.
|
static <T extends java.lang.Comparable<? super T>> |
ofAll(java.lang.Iterable<? extends T> elements)
Deprecated.
|
static <T extends java.lang.Comparable<? super T>> |
ofAll(java.util.stream.Stream<? extends T> javaStream)
Deprecated.
|
PriorityQueue<T> |
orElse(java.lang.Iterable<? extends T> other)
Deprecated.
Returns this
PriorityQueue if it is nonempty,
otherwise PriorityQueue created from iterable, using existing comparator. |
PriorityQueue<T> |
orElse(java.util.function.Supplier<? extends java.lang.Iterable<? extends T>> supplier)
Deprecated.
Returns this
PriorityQueue if it is nonempty,
otherwise PriorityQueue created from result of evaluating supplier, using existing comparator. |
Tuple2<? extends PriorityQueue<T>,? extends PriorityQueue<T>> |
partition(java.util.function.Predicate<? super T> predicate)
Deprecated.
Creates a partition of this
Traversable by splitting this elements in two in distinct traversables
according to a predicate. |
T |
peek()
Returns the first element without modifying it.
|
Q |
peek(java.util.function.Consumer<? super T> action)
Performs the given
action on the first element if this is an eager implementation. |
Option<T> |
peekOption()
Returns the first element without modifying the Queue.
|
Q |
removeAll(java.lang.Iterable<? extends T> elements) |
PriorityQueue<T> |
replace(T currentElement,
T newElement)
Deprecated.
Replaces the first occurrence (if exists) of the given currentElement with newElement.
|
PriorityQueue<T> |
replaceAll(T currentElement,
T newElement)
Deprecated.
Replaces all occurrences of the given currentElement with newElement.
|
Q |
retainAll(java.lang.Iterable<? extends T> elements)
Keeps all occurrences of the given elements from this.
|
PriorityQueue<T> |
scan(T zero,
java.util.function.BiFunction<? super T,? super T,? extends T> operation)
Deprecated.
Computes a prefix scan of the elements of the collection.
|
<U> PriorityQueue<U> |
scanLeft(U zero,
java.util.function.BiFunction<? super U,? super T,? extends U> operation)
Deprecated.
Produces a collection containing cumulative results of applying the
operator going left to right.
|
<U> PriorityQueue<U> |
scanRight(U zero,
java.util.function.BiFunction<? super T,? super U,? extends U> operation)
Deprecated.
Produces a collection containing cumulative results of applying the
operator going right to left.
|
Iterator<? extends PriorityQueue<T>> |
slideBy(java.util.function.Function<? super T,?> classifier)
Deprecated.
Slides a non-overlapping window of a variable size over this
Traversable. |
Iterator<? extends PriorityQueue<T>> |
sliding(int size)
Deprecated.
Slides a window of a specific
size and step size 1 over this Traversable by calling
Traversable.sliding(int, int). |
Iterator<? extends PriorityQueue<T>> |
sliding(int size,
int step)
Deprecated.
Slides a window of a specific
size and step size over this Traversable. |
Tuple2<? extends PriorityQueue<T>,? extends PriorityQueue<T>> |
span(java.util.function.Predicate<? super T> predicate)
Deprecated.
Returns a tuple where the first element is the longest prefix of elements that satisfy the given
predicate and the second element is the remainder. |
java.lang.String |
stringPrefix()
Deprecated.
Returns the name of this Value type, which is used by toString().
|
static <T> PriorityQueue<T> |
tabulate(int size,
java.util.function.Function<? super java.lang.Integer,? extends T> function)
Deprecated.
Returns a
PriorityQueue containing size values of a given Function function
over a range of integer values from 0 to size - 1. |
PriorityQueue<T> |
tail()
Deprecated.
Drops the first element of a non-empty
PriorityQueue. |
Option<Q> |
tailOption()
Drops the first element of a non-empty Traversable and returns an
Option. |
PriorityQueue<T> |
take(int n)
Deprecated.
Takes the first n elements of this or all elements, if this length < n.
|
PriorityQueue<T> |
takeRight(int n)
Deprecated.
Takes the last n elements of this or all elements, if this length < n.
|
PriorityQueue<T> |
takeUntil(java.util.function.Predicate<? super T> predicate)
Deprecated.
Takes elements until the predicate holds for the current element.
|
Q |
takeWhile(java.util.function.Predicate<? super T> predicate)
Takes elements while the predicate holds for the current element.
|
List<T> |
toList()
Deprecated.
Converts this to a
List. |
java.lang.String |
toString()
Clarifies that values have a proper toString() method implemented.
|
<U> U |
transform(java.util.function.Function<? super PriorityQueue<T>,? extends U> f)
Deprecated.
Transforms this
PriorityQueue. |
<U> PriorityQueue<Tuple2<T,U>> |
zip(java.lang.Iterable<? extends U> that)
Deprecated.
Returns a traversable formed from this traversable and another Iterable collection by combining
corresponding elements in pairs.
|
<U> PriorityQueue<Tuple2<T,U>> |
zipAll(java.lang.Iterable<? extends U> that,
T thisElem,
U thatElem)
Deprecated.
Returns a traversable formed from this traversable and another Iterable by combining corresponding elements in
pairs.
|
<U,R> PriorityQueue<R> |
zipWith(java.lang.Iterable<? extends U> that,
java.util.function.BiFunction<? super T,? super U,? extends R> mapper)
Deprecated.
Returns a traversable formed from this traversable and another Iterable collection by mapping elements.
|
PriorityQueue<Tuple2<T,java.lang.Integer>> |
zipWithIndex()
Deprecated.
Zips this traversable with its indices.
|
<U> PriorityQueue<U> |
zipWithIndex(java.util.function.BiFunction<? super T,? super java.lang.Integer,? extends U> mapper)
Deprecated.
Zips this traversable with its indices by applying mapper provided.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitarrangeBy, average, containsAll, count, existsUnique, find, findLast, fold, foldLeft, forEachWithIndex, get, headOption, isDistinct, isSequential, isSingleValued, iterator, lastOption, max, maxBy, maxBy, min, minBy, minBy, mkCharSeq, mkCharSeq, mkCharSeq, mkString, mkString, mkString, narrow, nonEmpty, product, reduce, reduceLeft, reduceLeftOption, reduceOption, reduceRight, reduceRightOption, single, singleOption, size, spliterator, sum, toLinkedMap, toMap, toSortedMap, toSortedMap, unzip, unzip3collect, collect, contains, corresponds, eq, exists, forAll, forEach, getOrElse, getOrElse, getOrElseThrow, getOrElseTry, getOrNull, narrow, out, out, stderr, stdout, toArray, toCharSeq, toCompletableFuture, toEither, toEither, toInvalid, toInvalid, toJavaArray, toJavaArray, toJavaArray, toJavaCollection, toJavaList, toJavaList, toJavaMap, toJavaMap, toJavaMap, toJavaOptional, toJavaParallelStream, toJavaSet, toJavaSet, toJavaStream, toLeft, toLeft, toLinkedMap, toLinkedMap, toLinkedSet, toMap, toMap, toOption, toPriorityQueue, toPriorityQueue, toQueue, toRight, toRight, toSet, toSortedMap, toSortedMap, toSortedMap, toSortedMap, toSortedSet, toSortedSet, toStream, toTree, toTree, toTry, toTry, toValid, toValid, toValidation, toValidation, toVectorpublic <R> PriorityQueue<R> collect(PartialFunction<? super T,? extends R> partialFunction)
TraversablepartialFunction by mapping the elements to type R.
More specifically, for each of this elements in iteration order first it is checked
partialFunction.isDefinedAt(element)
If the elements makes it through that filter, the mapped instance is added to the result collection
R newElement = partialFunction.apply(element)
Note:If this Traversable is ordered (i.e. extends Ordered,
the caller of collect has to ensure that the elements are comparable (i.e. extend Comparable).collect in interface Traversable<T>R - The new element typepartialFunction - A function that is not necessarily defined of all elements of this traversable.Traversable instance containing elements of type Rpublic PriorityQueue<T> enqueue(T element)
element - The new elementPriorityQueue instance, containing the new elementpublic PriorityQueue<T> enqueueAll(java.lang.Iterable<? extends T> elements)
elements - An PriorityQueue of elements, may be emptyPriorityQueue instance, containing the new elementsjava.lang.NullPointerException - if elements is nullpublic T head()
PriorityQueue.head in interface Traversable<T>PriorityQueue.java.util.NoSuchElementException - if this is emptypublic PriorityQueue<T> tail()
PriorityQueue.tail in interface Traversable<T>java.lang.UnsupportedOperationException - if this is emptypublic Tuple2<T,PriorityQueue<T>> dequeue()
public PriorityQueue<T> merge(PriorityQueue<T> target)
public boolean isAsync()
PriorityQueue is computed synchronously.public boolean isEmpty()
Traversablepublic boolean isLazy()
PriorityQueue is computed eagerly.public boolean isOrdered()
TraversableisOrdered in interface Traversable<T>public static <T extends java.lang.Comparable<? super T>> PriorityQueue<T> empty()
T - Component typepublic static <T> PriorityQueue<T> empty(java.util.Comparator<? super T> comparator)
public static <T> java.util.stream.Collector<T,java.util.ArrayList<T>,PriorityQueue<T>> collector()
Collector which may be used in conjunction with
Stream.collect(Collector) to obtain a PriorityQueue<T>.T - Component type of the PriorityQueue.PriorityQueue<T> Collector.public static <T> PriorityQueue<T> narrow(PriorityQueue<? extends T> queue)
PriorityQueue<? extends T> to PriorityQueue<T>
by performing a type-safe cast. This is eligible because immutable/read-only
collections are covariant.T - Component type of the PriorityQueue.queue - An PriorityQueue.PriorityQueue instance as narrowed type PriorityQueue<T>.public static <T extends java.lang.Comparable<? super T>> PriorityQueue<T> of(T element)
public static <T extends java.lang.Comparable<? super T>> PriorityQueue<T> of(T... elements)
public static <T> PriorityQueue<T> of(java.util.Comparator<? super T> comparator, T element)
public static <T> PriorityQueue<T> of(java.util.Comparator<? super T> comparator, T... elements)
public static <T extends java.lang.Comparable<? super T>> PriorityQueue<T> ofAll(java.lang.Iterable<? extends T> elements)
public static <T> PriorityQueue<T> ofAll(java.util.Comparator<? super T> comparator, java.lang.Iterable<? extends T> elements)
public static <T extends java.lang.Comparable<? super T>> PriorityQueue<T> ofAll(java.util.stream.Stream<? extends T> javaStream)
public static <T> PriorityQueue<T> ofAll(java.util.Comparator<? super T> comparator, java.util.stream.Stream<? extends T> javaStream)
public static <T> PriorityQueue<T> tabulate(int size, java.util.function.Function<? super java.lang.Integer,? extends T> function)
PriorityQueue containing size values of a given Function function
over a range of integer values from 0 to size - 1.T - Component type of the PriorityQueuesize - The number of elements in the PriorityQueuefunction - The Function computing element valuesPriorityQueue consisting of elements function(0),function(1), ..., function(size - 1)java.lang.NullPointerException - if function is nullpublic static <T> PriorityQueue<T> fill(int size, java.util.function.Supplier<? extends T> supplier)
T - Component type of the PriorityQueuesize - The number of elements in the PriorityQueuesupplier - The Supplier computing element valuesPriorityQueue of size size, where each element contains the result supplied by supplier.java.lang.NullPointerException - if supplier is nullpublic static <T> PriorityQueue<T> fill(int size, T element)
T - Component type of the PriorityQueuesize - The number of elements in the PriorityQueueelement - The elementPriorityQueue of size size, where each element is the given element.public List<T> toList()
ValueList.public final <U> U transform(java.util.function.Function<? super PriorityQueue<T>,? extends U> f)
PriorityQueue.U - Type of transformation resultf - A transformationUjava.lang.NullPointerException - if f is nullpublic PriorityQueue<T> distinct()
Traversableequals.distinct in interface Traversable<T>Traversable containing this elements without duplicatespublic PriorityQueue<T> distinctBy(java.util.Comparator<? super T> comparator)
Traversablecomparator.distinctBy in interface Traversable<T>comparator - A comparatorTraversable containing this elements without duplicatespublic <U> PriorityQueue<T> distinctBy(java.util.function.Function<? super T,? extends U> keyExtractor)
Traversableequals.
The elements of the result are determined in the order of their occurrence - first match wins.
distinctBy in interface Traversable<T>U - key typekeyExtractor - A key extractorTraversable containing this elements without duplicatespublic PriorityQueue<T> drop(int n)
Traversabledrop in interface Traversable<T>n - The number of elements to drop.public PriorityQueue<T> dropRight(int n)
TraversabledropRight in interface Traversable<T>n - The number of elements to drop.public PriorityQueue<T> dropWhile(java.util.function.Predicate<? super T> predicate)
Traversable
Note: This is essentially the same as dropUntil(predicate.negate()).
It is intended to be used with method references, which cannot be negated directly.
dropWhile in interface Traversable<T>predicate - A condition tested subsequently for this elements.public PriorityQueue<T> filter(java.util.function.Predicate<? super T> predicate)
Traversablefilter in interface Traversable<T>predicate - A predicatepublic <U> PriorityQueue<U> flatMap(java.util.function.Function<? super T,? extends java.lang.Iterable<? extends U>> mapper)
TraversableflatMap in interface Traversable<T>U - The resulting component type.mapper - A mapperpublic <U> PriorityQueue<U> flatMap(java.util.Comparator<U> comparator, java.util.function.Function<? super T,? extends java.lang.Iterable<? extends U>> mapper)
public <U> U foldRight(U zero,
java.util.function.BiFunction<? super T,? super U,? extends U> accumulator)
PriorityQueue by successively calling the given function f from the right,
starting with a value zero of type B.
Example: PriorityQueue.of("a", "b", "c").foldRight("", (x, xs) -> x + xs) = "abc"
foldRight in interface Foldable<T>foldRight in interface Traversable<T>U - the type of the folded valuezero - Value to start the accumulation with.accumulator - The accumulator function.java.lang.NullPointerException - if f is nullpublic <C> Map<C,? extends PriorityQueue<T>> groupBy(java.util.function.Function<? super T,? extends C> classifier)
TraversablegroupBy in interface Traversable<T>C - classified class typeclassifier - A function which classifies elements into classesTraversable.arrangeBy(Function)public Iterator<? extends PriorityQueue<T>> grouped(int size)
TraversableTraversable into fixed size blocks.
Let length be the length of this Iterable. Then grouped is defined as follows:
this.isEmpty(), the resulting Iterator is empty.size <= length, the resulting Iterator will contain length / size blocks of size
size and maybe a non-empty block of size length % size, if there are remaining elements.size > length, the resulting Iterator will contain one block of size length.
[].grouped(1) = []
[].grouped(0) throws
[].grouped(-1) throws
[1,2,3,4].grouped(2) = [[1,2],[3,4]]
[1,2,3,4,5].grouped(2) = [[1,2],[3,4],[5]]
[1,2,3,4].grouped(5) = [[1,2,3,4]]
Please note that grouped(int) is a special case of Traversable.sliding(int, int), i.e.
grouped(size) is the same as sliding(size, size).grouped in interface Traversable<T>size - a positive block sizepublic boolean hasDefiniteSize()
PriorityQueue is known to have a finite size.
This method should be implemented by classes only, i.e. not by interfaces.
hasDefiniteSize in interface Traversable<T>PriorityQueue is known to have a finite size, false otherwise.public PriorityQueue<T> init()
init in interface Traversable<T>java.lang.UnsupportedOperationException - if this is emptypublic boolean isTraversableAgain()
PriorityQueue can be repeatedly traversed.
This method should be implemented by classes only, i.e. not by interfaces.
isTraversableAgain in interface Traversable<T>PriorityQueue is known to be traversable repeatedly, false otherwise.public T last()
Traversablelast in interface Traversable<T>public int length()
PriorityQueue.
Same as Traversable.size().
length in interface Traversable<T>public <U> PriorityQueue<U> map(java.util.function.Function<? super T,? extends U> mapper)
TraversableTraversable to elements of a new type preserving their order, if any.public <U> PriorityQueue<U> map(java.util.Comparator<U> comparator, java.util.function.Function<? super T,? extends U> mapper)
public PriorityQueue<T> orElse(java.lang.Iterable<? extends T> other)
PriorityQueue if it is nonempty,
otherwise PriorityQueue created from iterable, using existing comparator.orElse in interface Traversable<T>other - An alternative TraversablePriorityQueue if it is nonempty,
otherwise PriorityQueue created from iterable, using existing comparator.public PriorityQueue<T> orElse(java.util.function.Supplier<? extends java.lang.Iterable<? extends T>> supplier)
PriorityQueue if it is nonempty,
otherwise PriorityQueue created from result of evaluating supplier, using existing comparator.orElse in interface Traversable<T>supplier - An alternative TraversablePriorityQueue if it is nonempty,
otherwise PriorityQueue created from result of evaluating supplier, using existing comparator.public Tuple2<? extends PriorityQueue<T>,? extends PriorityQueue<T>> partition(java.util.function.Predicate<? super T> predicate)
TraversableTraversable by splitting this elements in two in distinct traversables
according to a predicate.partition in interface Traversable<T>predicate - A predicate which classifies an element if it is in the first or the second traversable.Traversable contains all elements that satisfy the given predicate, the second Traversable contains all elements that don't. The original order of elements is preserved.public PriorityQueue<T> replace(T currentElement, T newElement)
Traversablereplace in interface Traversable<T>currentElement - An element to be substituted.newElement - A replacement for currentElement.public PriorityQueue<T> replaceAll(T currentElement, T newElement)
TraversablereplaceAll in interface Traversable<T>currentElement - An element to be substituted.newElement - A replacement for currentElement.public PriorityQueue<T> scan(T zero, java.util.function.BiFunction<? super T,? super T,? extends T> operation)
Traversablescan in interface Traversable<T>zero - neutral element for the operator opoperation - the associative operator for the scanpublic <U> PriorityQueue<U> scanLeft(U zero, java.util.function.BiFunction<? super U,? super T,? extends U> operation)
TraversablescanLeft in interface Traversable<T>U - the type of the elements in the resulting collectionzero - the initial valueoperation - the binary operator applied to the intermediate result and the elementpublic <U> PriorityQueue<U> scanRight(U zero, java.util.function.BiFunction<? super T,? super U,? extends U> operation)
TraversablescanRight in interface Traversable<T>U - the type of the elements in the resulting collectionzero - the initial valueoperation - the binary operator applied to the intermediate result and the elementpublic Iterator<? extends PriorityQueue<T>> slideBy(java.util.function.Function<? super T,?> classifier)
TraversableTraversable.
Each window contains elements with the same class, as determined by classifier. Two consecutive
values in this Traversable will be in the same window only if classifier returns equal
values for them. Otherwise, the values will constitute the last element of the previous window and the
first element of the next window.
Examples:
[].slideBy(Function.identity()) = []
[1,2,3,4,4,5].slideBy(Function.identity()) = [[1],[2],[3],[4,4],[5]]
[1,2,3,10,12,5,7,20,29].slideBy(x -> x/10) = [[1,2,3],[10,12],[5,7],[20,29]]
slideBy in interface Traversable<T>classifier - A function which classifies elements into classespublic Iterator<? extends PriorityQueue<T>> sliding(int size)
Traversablesize and step size 1 over this Traversable by calling
Traversable.sliding(int, int).sliding in interface Traversable<T>size - a positive window sizepublic Iterator<? extends PriorityQueue<T>> sliding(int size, int step)
Traversablesize and step size over this Traversable.
Examples:
[].sliding(1,1) = []
[1,2,3,4,5].sliding(2,3) = [[1,2],[4,5]]
[1,2,3,4,5].sliding(2,4) = [[1,2],[5]]
[1,2,3,4,5].sliding(2,5) = [[1,2]]
[1,2,3,4].sliding(5,3) = [[1,2,3,4]]
sliding in interface Traversable<T>size - a positive window sizestep - a positive step sizepublic Tuple2<? extends PriorityQueue<T>,? extends PriorityQueue<T>> span(java.util.function.Predicate<? super T> predicate)
Traversablepredicate and the second element is the remainder.span in interface Traversable<T>predicate - A predicate.Tuple containing the longest prefix of elements that satisfy p and the remainder.public PriorityQueue<T> take(int n)
Traversable
The result is equivalent to sublist(0, max(0, min(length(), n))) but does not throw if n < 0 or
n > length().
In the case of n < 0 the empty instance is returned, in the case of n > length() this is returned.
take in interface Traversable<T>n - The number of elements to take.public PriorityQueue<T> takeRight(int n)
Traversable
The result is equivalent to sublist(max(0, min(length(), length() - n)), n), i.e. takeRight will not
throw if n < 0 or n > length().
In the case of n < 0 the empty instance is returned, in the case of n > length() this is returned.
takeRight in interface Traversable<T>n - The number of elements to take.public PriorityQueue<T> takeUntil(java.util.function.Predicate<? super T> predicate)
Traversable
Note: This is essentially the same as takeWhile(predicate.negate()). It is intended to be used with
method references, which cannot be negated directly.
takeUntil in interface Traversable<T>predicate - A condition tested subsequently for this elements.public <U> PriorityQueue<Tuple2<T,U>> zip(java.lang.Iterable<? extends U> that)
Traversable
The length of the returned traversable is the minimum of the lengths of this traversable and that
iterable.
zip in interface Traversable<T>U - The type of the second half of the returned pairs.that - The Iterable providing the second half of each result pair.that iterable.public <U,R> PriorityQueue<R> zipWith(java.lang.Iterable<? extends U> that, java.util.function.BiFunction<? super T,? super U,? extends R> mapper)
Traversable
The length of the returned traversable is the minimum of the lengths of this traversable and that
iterable.
zipWith in interface Traversable<T>U - The type of the second parameter of the mapper.R - The type of the mapped elements.that - The Iterable providing the second parameter of the mapper.mapper - a mapper.that iterable.public <U> PriorityQueue<Tuple2<T,U>> zipAll(java.lang.Iterable<? extends U> that, T thisElem, U thatElem)
Traversable
The length of the returned traversable is the maximum of the lengths of this traversable and that
iterable.
Special case: if this traversable is shorter than that elements, and that elements contains duplicates, the resulting traversable may be shorter than the maximum of the lengths of this and that because a traversable contains an element at most once.
If this Traversable is shorter than that, thisElem values are used to fill the result. If that is shorter than this Traversable, thatElem values are used to fill the result.
zipAll in interface Traversable<T>U - The type of the second half of the returned pairs.that - The Iterable providing the second half of each result pair.thisElem - The element to be used to fill up the result if this traversable is shorter than that.thatElem - The element to be used to fill up the result if that is shorter than this traversable.public PriorityQueue<Tuple2<T,java.lang.Integer>> zipWithIndex()
TraversablezipWithIndex in interface Traversable<T>public <U> PriorityQueue<U> zipWithIndex(java.util.function.BiFunction<? super T,? super java.lang.Integer,? extends U> mapper)
TraversablezipWithIndex in interface Traversable<T>U - The type of the mapped elements.mapper - a mapper.public java.lang.String stringPrefix()
ValuestringPrefix in interface Value<T>public boolean equals(java.lang.Object o)
TraversableNotes:
public int hashCode()
Traversable
int hash = 1;
for (T t : this) { hash = hash * 31 + Objects.hashCode(t); }
Collections with arbitrary iteration order are hashed in a way such that the hash of a fixed number of elements is independent of their iteration order.
int hash = 1;
for (T t : this) { hash += Objects.hashCode(t); }
Please note that the particular hashing algorithms may change in a future version of Vavr.
public final class Hashed<K> {
private final K key;
private final Lazy<Integer> hashCode;
public Hashed(K key) {
this.key = key;
this.hashCode = Lazy.of(() -> Objects.hashCode(key));
}
public K key() {
return key;
}
@Override
public boolean equals(Object o) {
if (o == key) {
return true;
} else if (key != null && o instanceof Hashed) {
final Hashed that = (Hashed) o;
return key.equals(that.key);
} else {
return false;
}
}
@Override
public int hashCode() {
return hashCode.get();
}
@Override
public String toString() {
return "Hashed(" + (key == null ? "null" : key.toString()) + ")";
}
}
public java.util.Comparator<T> comparator()
Orderedcomparator in interface Ordered<T>public Option<Tuple2<T,Q>> dequeueOption()
None if this Queue is empty, otherwise Some Tuple containing the first element and the remaining elements of this Queuepublic Q enqueue(T... elements)
elements - Elements, may be emptyQueue instance, containing the new elementsjava.lang.NullPointerException - if elements is nullpublic T peek()
java.util.NoSuchElementException - if this Queue is emptypublic Option<T> peekOption()
None if this Queue is empty, otherwise a Some containing the first elementpublic Q dropUntil(java.util.function.Predicate<? super T> predicate)
TraversabledropUntil in interface Traversable<T>predicate - A condition tested subsequently for this elements.public Q filterNot(java.util.function.Predicate<? super T> predicate)
TraversableThe default implementation is equivalent to
filter(predicate.negate()filterNot in interface Traversable<T>predicate - A predicatepublic Option<Q> initOption()
Option.initOption in interface Traversable<T>Some(Q) or None if this is empty.public Option<Q> tailOption()
TraversableOption.tailOption in interface Traversable<T>Some(traversable) or None if this is empty.public Q retainAll(java.lang.Iterable<? extends T> elements)
TraversableretainAll in interface Traversable<T>elements - Elements to be kept.public Q removeAll(java.lang.Iterable<? extends T> elements)
public Q takeWhile(java.util.function.Predicate<? super T> predicate)
TraversabletakeWhile in interface Traversable<T>predicate - A condition tested subsequently for the contained elements.public Q peek(java.util.function.Consumer<? super T> action)
Valueaction on the first element if this is an eager implementation.
Performs the given action on all elements (the first immediately, successive deferred),
if this is a lazy implementation.peek in interface Traversable<T>peek in interface Value<T>action - The action that will be performed on the element(s).public java.lang.String toString()
ValueSee Object.toString().