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

ru.yandex.bolts.collection.ListF Maven / Gradle / Ivy

The newest version!
package ru.yandex.bolts.collection;

import java.util.Collection;
import java.util.Iterator;
import java.util.List;

import ru.yandex.bolts.collection.impl.ArrayListF;
import ru.yandex.bolts.function.Function;
import ru.yandex.bolts.function.Function1B;
import ru.yandex.bolts.function.Function2;


public interface ListF extends CollectionF, List {

    IteratorF iterator();

    IteratorF reverseIterator();

    @Override
    ListF filter(Function1B p);

    @Override
    ListF filterNot(Function1B p);

    @Override
    ListF filterNotNull();


    @Override
     ListF filterByType(Class type);

    /**
     * Return pair of lists, first list contains elements matching p
     * and second lists contains elements matching !p.
     *
     * @param p function
     *
     * @return tuple
     */
    @Override
    Tuple2, ListF> partition(Function1B p);


    @Override
    ListF stableUnique();


    ListF subList(int fromIndex, int toIndex);


    Tuple2List zipWithIndex();


    ListF plus(List addition);

    ListF plus(Collection elements);

    ListF plus(Iterator iterator);

    @SuppressWarnings("unchecked")
    ListF plus(E... additions);

    ListF plus1(E e);


    E first() throws IndexOutOfBoundsException;


    E last() throws IndexOutOfBoundsException;

    /**
     * Return Option.some(first()) or Option.none().
     *
     * @return option first
     */
    Option firstO();

    /**
     * Return Option.some(last()) or Option.none().
     *
     * @return option last
     */
    Option lastO();

    /** Task first count elements
     *
     * @param count count
     *
     * @return list
     * */
    ListF take(int count);


    ListF drop(int count);

    ListF rtake(int count);

    ListF rdrop(int count);


    ListF takeWhile(Function1B f);


    ListF dropWhile(Function1B f);


     B foldRight(B z, Function2 f);


    E reduceRight(Function2 f);

    Option reduceRightO(Function2 f);


    ListF makeReadOnly();


    int length();


    ListF reverse();

    @Override
     ListF uncheckedCast();

    @Override
     ListF cast();

    @Override
     ListF cast(Class type);


     Tuple2List zip(ListF that);

     Tuple2List zipWith(Function f);


    @Override
    boolean remove(Object o);
    boolean removeTs(E e);
    boolean removeTu(Object e);


    @Override
    boolean removeAll(Collection c);
    boolean removeAllTs(Collection c);
    boolean removeAllTu(Collection c);


    @Override
    boolean contains(Object o);
    boolean containsTs(E e);
    boolean containsTu(Object e);


    @Override
    boolean containsAll(Collection coll);
    boolean containsAllTs(Collection coll);
    boolean containsAllTu(Collection coll);


    @Override
    boolean retainAll(Collection c);
    boolean retainAllTs(Collection c);
    boolean retainAllTu(Collection c);

    @Override
    int indexOf(Object o);
    int indexOfTs(E o);
    int indexOfTu(Object o);

} //~