Package com._1c.g5.v8.dt.compare.core
Class ComparisonUtils.Sequence<U>
- java.lang.Object
-
- com._1c.g5.v8.dt.compare.core.ComparisonUtils.Sequence<U>
-
- Type Parameters:
U
- the type of elements in this sequence
- Enclosing class:
- ComparisonUtils
public static class ComparisonUtils.Sequence<U> extends Object
The sequence of elements. Allows to get subsequences from this sequence quickly.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(U element, BiFunction<U,U,Boolean> equalityFunction)
Returnstrue
if this sequence contains the specified element.U
get(int index)
Returns the element at the specified position in this sequence.boolean
isEmpty()
Returnstrue
if this sequence contains no elements.ComparisonUtils.Sequence<U>
reverse()
Reverses the order of the elements in this sequnce.int
size()
Returns the number of elements in this sequence.ComparisonUtils.Sequence<U>
subSequence(int fromIndex, int toIndex)
Returns a view of the portion of this sequence between the specifiedfromIndex
(inclusive) andtoIndex
(exclusive).List<U>
toList()
Returns this sequnce as list.
-
-
-
Method Detail
-
get
public U get(int index)
Returns the element at the specified position in this sequence.- Parameters:
index
- the index of the element to return- Returns:
- the element at the specified position in this sequence
- Throws:
IndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= size()
)
-
size
public int size()
Returns the number of elements in this sequence.- Returns:
- the number of elements in this sequence
-
isEmpty
public boolean isEmpty()
Returnstrue
if this sequence contains no elements.- Returns:
true
if this sequence contains no elements,false
otherwise
-
contains
public boolean contains(U element, BiFunction<U,U,Boolean> equalityFunction)
Returnstrue
if this sequence contains the specified element.- Parameters:
element
- the element whose presence in this sequence is to be testedequalityFunction
- the function of equality of elements, cannot benull
- Returns:
true
if this sequence contains the specified element,false
otherwise
-
subSequence
public ComparisonUtils.Sequence<U> subSequence(int fromIndex, int toIndex)
Returns a view of the portion of this sequence between the specifiedfromIndex
(inclusive) andtoIndex
(exclusive).- Parameters:
fromIndex
- the low endpoint (inclusive) of the subSequencetoIndex
- the high endpoint (exclusive) of the subSequence- Returns:
- a view of the specified range within this sequence, never
null
-
toList
public List<U> toList()
Returns this sequnce as list.- Returns:
- this sequnce as list, never
null
-
reverse
public ComparisonUtils.Sequence<U> reverse()
Reverses the order of the elements in this sequnce.- Returns:
- the sequence obtained from this sequnce by reversing the order of the elements, never
null
-
-