java.lang.Object
ArraySeq<T>
- All Implemented Interfaces:
BaseSeq<T>
,Seq<T>
,Serializable
,Iterable<T>
,IntFunction<T>
,RandomAccess
- Since:
- 1.4
- Version:
- 5.2
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Compares the specified object with this sequence for equality.boolean
Tests whether a predicate holds for all elements of this sequence.void
final T
get
(int index) Return the value at the givenindex
.int
hashCode()
Returns the hash code value for this sequence.int
indexWhere
(Predicate<? super T> predicate, int start, int end) Returns the index of the first element on which the given predicate returnstrue
, or -1 if the predicate returns false for every sequence element.int
lastIndexWhere
(Predicate<? super T> predicate, int start, int end) Returns the index of the last element on which the given predicate returnstrue
, or -1 if the predicate returns false for every sequence element.int
length()
Return the length of this sequence.toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.jenetics.util.BaseSeq
isEmpty, iterator, listIterator, nonEmpty, spliterator, stream
Methods inherited from interface io.jenetics.util.Seq
append, append, apply, asISeq, asList, asMSeq, contains, indexOf, indexOf, indexOf, indexWhere, indexWhere, isSorted, isSorted, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexWhere, lastIndexWhere, map, parallelStream, prepend, prepend, size, subSeq, subSeq, toArray, toArray, toArray, toString, toString
-
Field Details
-
array
-
-
Constructor Details
-
ArraySeq
-
-
Method Details
-
get
Description copied from interface:BaseSeq
Return the value at the givenindex
. -
forEach
-
forAll
Description copied from interface:Seq
Tests whether a predicate holds for all elements of this sequence. -
indexWhere
Description copied from interface:Seq
Returns the index of the first element on which the given predicate returns
true
, or -1 if the predicate returns false for every sequence element.// Finding index of first null value. final int index = seq.indexOf(o -> o == null); // Assert of no null values. assert (sequence.indexOf(o -> o == null) == -1);
- Specified by:
indexWhere
in interfaceSeq<T>
- Parameters:
predicate
- the search predicate.start
- the search start indexend
- the search end index- Returns:
- the index of the first element on which the given predicate
returns
true
, or -1 if the predicate returnsfalse
for every sequence element.
-
lastIndexWhere
Description copied from interface:Seq
Returns the index of the last element on which the given predicate returnstrue
, or -1 if the predicate returns false for every sequence element.- Specified by:
lastIndexWhere
in interfaceSeq<T>
- Parameters:
predicate
- the search predicate.start
- the search start indexend
- the search end index- Returns:
- the index of the last element on which the given predicate
returns
true
, or -1 if the predicate returns false for every sequence element.
-
length
Description copied from interface:BaseSeq
Return the length of this sequence. Once the sequence is created, the length can't be changed. -
toString
-
hashCode
Description copied from interface:Seq
Returns the hash code value for this sequence. The hash code is defined as followed:int hashCode = 1; final Iterator<E> it = seq.iterator(); while (it.hasNext()) { final E obj = it.next(); hashCode = 31*hashCode + (obj == null ? 0 : obj.hashCode()); }
-
equals
Description copied from interface:Seq
Compares the specified object with this sequence for equality. Returns true if and only if the specified object is also a sequence, both sequence have the same size, and all corresponding pairs of elements in the two sequences are equal. (Two elements e1 and e2 are equal if (e1==null ? e2==null : e1.equals(e2)).) This definition ensures that the equals method works properly across different implementations of the Seq interface.
-