T
- Component type of the Stream.public static final class Stream.Empty<T> extends Object implements Stream<T>, Serializable
This is a singleton, i.e. not Cloneable.
Stream.Cons<T>, Stream.Empty<T>
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o)
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.
|
int |
hashCode()
Returns the hash code of this collection.
|
T |
head()
Returns the first element of a non-empty Traversable.
|
static <T> Stream.Empty<T> |
instance()
Returns the singleton empty Stream instance.
|
boolean |
isEmpty()
Checks if this Traversable is empty.
|
Iterator<T> |
iterator()
An iterator by means of head() and tail().
|
Stream<T> |
tail()
Drops the first element of a non-empty Traversable.
|
String |
toString()
Clarifies that values have a proper toString() method implemented.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
append, appendAll, appendSelf, asJava, asJava, asJavaMutable, asJavaMutable, collect, collector, combinations, combinations, concat, concat, cons, continually, continually, crossProduct, cycle, cycle, distinct, distinctBy, distinctBy, drop, dropRight, dropRightUntil, dropRightWhile, dropUntil, dropWhile, empty, extend, extend, extend, fill, fill, filter, flatMap, from, from, from, from, get, groupBy, grouped, hasDefiniteSize, indexOf, init, initOption, insert, insertAll, intersperse, isAsync, isLazy, isTraversableAgain, iterate, iterate, last, lastIndexOf, leftPadTo, length, map, narrow, of, of, ofAll, ofAll, ofAll, ofAll, ofAll, ofAll, ofAll, ofAll, ofAll, ofAll, orElse, orElse, padTo, partition, patch, peek, permutations, prepend, prependAll, range, range, range, rangeBy, rangeBy, rangeBy, rangeBy, rangeClosed, rangeClosed, rangeClosed, rangeClosedBy, rangeClosedBy, rangeClosedBy, rangeClosedBy, reject, remove, removeAll, removeAll, removeAll, removeAt, removeFirst, removeLast, replace, replaceAll, retainAll, reverse, rotateLeft, rotateRight, scan, scanLeft, scanRight, shuffle, slice, slideBy, sliding, sliding, sortBy, sortBy, sorted, sorted, span, splitAt, splitAt, splitAtInclusive, stringPrefix, subSequence, subSequence, tabulate, tailOption, take, takeRight, takeRightUntil, takeRightWhile, takeUntil, takeWhile, transform, transpose, unfold, unfoldLeft, unfoldRight, unzip, unzip3, update, update, zip, zipAll, zipWith, zipWithIndex, zipWithIndex
asPartialFunction, indexOfSlice, indexWhere, isDefinedAt, lastIndexOfSlice, lastIndexWhere, narrow, reverseIterator, search, search, segmentLength
apply, containsSlice, crossProduct, crossProduct, endsWith, foldRight, indexOf, indexOfOption, indexOfOption, indexOfSlice, indexOfSliceOption, indexOfSliceOption, indexWhere, indexWhereOption, indexWhereOption, isSequential, iterator, lastIndexOf, lastIndexOfOption, lastIndexOfOption, lastIndexOfSlice, lastIndexOfSliceOption, lastIndexOfSliceOption, lastIndexWhere, lastIndexWhereOption, lastIndexWhereOption, lift, narrow, prefixLength, startsWith, startsWith, withDefault, withDefaultValue
arrangeBy, average, containsAll, count, existsUnique, find, findLast, foldLeft, forEachWithIndex, get, headOption, isDistinct, isOrdered, isSingleValued, lastOption, max, maxBy, maxBy, min, minBy, minBy, mkCharSeq, mkCharSeq, mkCharSeq, mkString, mkString, mkString, narrow, nonEmpty, product, reduceLeft, reduceLeftOption, reduceRight, reduceRightOption, single, singleOption, size, spliterator, sum
fold, reduce, reduceOption
collect, 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, toList, toMap, toMap, toOption, toPriorityQueue, toPriorityQueue, toQueue, toRight, toRight, toSet, toSortedMap, toSortedMap, toSortedMap, toSortedMap, toSortedSet, toSortedSet, toStream, toTree, toTree, toTry, toTry, toValid, toValid, toValidation, toValidation, toVector
getIfDefined, unlift
public static <T> Stream.Empty<T> instance()
T
- Component type of the Streampublic T head()
Traversable
head
in interface Traversable<T>
public boolean isEmpty()
Traversable
public Iterator<T> iterator()
Traversable
public Stream<T> tail()
Traversable
public boolean equals(Object o)
Traversable
Notes:
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()) + ")";
}
}
Copyright © 2020. All Rights Reserved.