Interface Sequence<Value_,Difference_ extends Comparable<Difference_>>
- Type Parameters:
Value_- The type of value in the sequence.Difference_- The type of difference between values in the sequence.
public interface Sequence<Value_,Difference_ extends Comparable<Difference_>>
Represents a series of consecutive values.
For instance, the list [1,2,4,5,6,10] has three sequences: [1,2], [4,5,6], and [10].
-
Method Summary
Modifier and TypeMethodDescriptionintgetCount()@NonNull Value_@NonNull Collection<Value_>getItems()@NonNull Value_@NonNull Difference_@Nullable Break<Value_,Difference_> @Nullable Break<Value_,Difference_> booleanisFirst()booleanisLast()
-
Method Details
-
getFirstItem
@NonNull Value_ getFirstItem()- Returns:
- the first item in the sequence.
-
getLastItem
@NonNull Value_ getLastItem()- Returns:
- the last item in the sequence.
-
isFirst
boolean isFirst()- Returns:
- true if and only if this is the first sequence
-
isLast
boolean isLast()- Returns:
- true if and only if this is the last sequence
-
getPreviousBreak
@Nullable Break<Value_,Difference_> getPreviousBreak()- Returns:
- If this is not the first sequence, the break before it. Otherwise, null.
-
getNextBreak
@Nullable Break<Value_,Difference_> getNextBreak()- Returns:
- If this is not the last sequence, the break after it. Otherwise, null.
-
getItems
@NonNull Collection<Value_> getItems()- Returns:
- items in this sequence
-
getCount
int getCount()- Returns:
- the number of items in this sequence
-
getLength
@NonNull Difference_ getLength()- Returns:
- the difference between the last item and first item in this sequence
-