javaslang.collection.Seq Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of javaslang Show documentation
Show all versions of javaslang Show documentation
Javaslang is a Java standard library extension built for Java 8 and above.
/** / \____ _ ______ _____ / \____ ____ _____
* / \__ \/ \ / \__ \ / __// \__ \ / \/ __ \ Javaslang
* _/ // _\ \ \/ / _\ \\_ \/ // _\ \ /\ \__/ / Copyright 2014-2015 Daniel Dietrich
* /___/ \_____/\____/\_____/____/\___\_____/_/ \_/____/ Licensed under the Apache License, Version 2.0
*/
package javaslang.collection;
import javaslang.Tuple;
import java.util.Comparator;
import java.util.Iterator;
public interface Seq extends Traversable {
Seq append(T element);
Seq appendAll(Iterable extends T> elements);
T get(int index);
int indexOf(T element);
Seq insert(int index, T element);
Seq insertAll(int index, Iterable extends T> elements);
default Iterator iterator(int index) {
return subsequence(index).iterator();
}
int lastIndexOf(T element);
Seq prepend(T element);
Seq prependAll(Iterable extends T> elements);
Seq set(int index, T element);
Seq sort();
Seq sort(Comparator super T> c);
/**
* Splits a Traversable at the specified index. The result of {@code splitAt(n)} is equivalent to
* {@code Tuple.of(take(n), drop(n))}.
*
* @param n An index.
* @return A Tuple containing the first n and the remaining elements.
*/
Tuple.Tuple2 extends Traversable, ? extends Traversable> splitAt(int n);
Seq subsequence(int beginIndex);
Seq subsequence(int beginIndex, int endIndex);
}