All Downloads are FREE. Search and download functionalities are using the official Maven repository.

javaslang.collection.Seq Maven / Gradle / Ivy

There is a newer version: 2.0.0-RC4
Show newest version
/**    / \____  _    ______   _____ / \____   ____  _____
 *    /  \__  \/ \  / \__  \ /  __//  \__  \ /    \/ __  \   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 elements);

    T get(int index);

    int indexOf(T element);

    Seq insert(int index, T element);

    Seq insertAll(int index, Iterable elements);

    default Iterator iterator(int index) {
        return subsequence(index).iterator();
    }

    int lastIndexOf(T element);

    Seq prepend(T element);

    Seq prependAll(Iterable elements);

    Seq set(int index, T element);

    Seq sort();

    Seq sort(Comparator 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> splitAt(int n);

    Seq subsequence(int beginIndex);

    Seq subsequence(int beginIndex, int endIndex);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy