ru.yandex.bolts.collection
Interface ListF<E>

All Superinterfaces:
Collection<E>, CollectionF<E>, Iterable<E>, IterableF<E>, List<E>
All Known Implementing Classes:
AbstractListF, ArrayListBase, ArrayListF, DefaultListF, EmptyList, ListMap, ListOf2, Option, Option.None, Option.Some, ReadOnlyArrayList, SingletonList, UnmodifiableDefaultListF

public interface ListF<E>
extends CollectionF<E>, List<E>

Extended list.

Author:
Stepan Koltsov, Iliya Roubin
See Also:
CollectionF

Method Summary
 ListF<E> drop(int count)
          Drop first count elements
 ListF<E> filter(Function1B<? super E> p)
          Return collection with only elements that match predicate.
 Tuple2<ListF<E>,ListF<E>> filter2(Function1B<? super E> p)
          Return pair of lists, first list contains elements matching p and second lists contains elements matching !p.
 E first()
          First element
 Option<E> firstO()
          Return Option.some(first()) or Option.none().
 IteratorF<E> iterator()
          Iterate list
 E last()
          Last element
 Option<E> lastO()
          Return Option.some(last()) or Option.none().
 int length()
          Alias for Collection.size()
 ListF<E> plus(Collection<? extends E> elements)
          Collection with all elements of this collection and that collection.
 ListF<E> plus(E... additions)
          Varargs variant of CollectionF.plus(Collection).
 ListF<E> plus(Iterator<? extends E> iterator)
          Collection with all elements of this collection and that collection.
 ListF<E> plus(List<? extends E> addition)
          Concatenate two lists
 ListF<E> plus1(E e)
          This collection plus one element.
 ListF<E> reverse()
          List with elements in reverse order
 IteratorF<E> reverseIterator()
           
 ListF<E> subList(int fromIndex, int toIndex)
          Sub list from index to index
 ListF<E> take(int count)
          Task first count elements
<F> ListF<F>
uncheckedCast()
          Return this with another type parameter and no type checks.
 ListF<E> unmodifiable()
          Unmodifiable view or copy of this collection
<B> ListMap<E,B>
zip(ListF<B> that)
          List of pairs of elements with the same index in two lists
 ListF<Tuple2<E,Integer>> zipWithIndex()
          Zip with index
 
Methods inherited from interface ru.yandex.bolts.collection.CollectionF
addAll, addF, addOp, containsF, containsP, flatMap, flatMapO, groupBy, map, max, max, min, min, single, singleO, sort, sort, sortBy, sortByDesc, toArray, toBooleanArray, toByteArray, toCharArray, toDoubleArray, toFloatArray, toIntArray, toList, toLongArray, toMap, toMapMappingToKey, toMapMappingToValue, toShortArray, unique
 
Methods inherited from interface ru.yandex.bolts.collection.IterableF
exists, find, foldLeft, foldRight, forAll, forEach, mkString, mkString, reduceLeft, reduceRight
 
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, toArray, toArray
 

Method Detail

iterator

IteratorF<E> iterator()
Iterate list

Specified by:
iterator in interface Collection<E>
Specified by:
iterator in interface CollectionF<E>
Specified by:
iterator in interface Iterable<E>
Specified by:
iterator in interface IterableF<E>
Specified by:
iterator in interface List<E>

reverseIterator

IteratorF<E> reverseIterator()

filter

ListF<E> filter(Function1B<? super E> p)
Description copied from interface: CollectionF
Return collection with only elements that match predicate.

Specified by:
filter in interface CollectionF<E>

filter2

Tuple2<ListF<E>,ListF<E>> filter2(Function1B<? super E> p)
Return pair of lists, first list contains elements matching p and second lists contains elements matching !p.

Specified by:
filter2 in interface CollectionF<E>

subList

ListF<E> subList(int fromIndex,
                 int toIndex)
Sub list from index to index

Specified by:
subList in interface List<E>

zipWithIndex

ListF<Tuple2<E,Integer>> zipWithIndex()
Zip with index


plus

ListF<E> plus(List<? extends E> addition)
Concatenate two lists


plus

ListF<E> plus(Collection<? extends E> elements)
Description copied from interface: CollectionF
Collection with all elements of this collection and that collection.

Specified by:
plus in interface CollectionF<E>

plus

ListF<E> plus(Iterator<? extends E> iterator)
Description copied from interface: CollectionF
Collection with all elements of this collection and that collection.

Specified by:
plus in interface CollectionF<E>

plus

ListF<E> plus(E... additions)
Description copied from interface: CollectionF
Varargs variant of CollectionF.plus(Collection).

Specified by:
plus in interface CollectionF<E>

plus1

ListF<E> plus1(E e)
Description copied from interface: CollectionF
This collection plus one element.

Specified by:
plus1 in interface CollectionF<E>

first

E first()
        throws IndexOutOfBoundsException
First element

Throws:
IndexOutOfBoundsException

last

E last()
       throws IndexOutOfBoundsException
Last element

Throws:
IndexOutOfBoundsException

firstO

Option<E> firstO()
Return Option.some(first()) or Option.none().


lastO

Option<E> lastO()
Return Option.some(last()) or Option.none().


take

ListF<E> take(int count)
Task first count elements


drop

ListF<E> drop(int count)
Drop first count elements


unmodifiable

ListF<E> unmodifiable()
Unmodifiable view or copy of this collection

Specified by:
unmodifiable in interface CollectionF<E>
See Also:
Collections.unmodifiableCollection(Collection)

length

int length()
Alias for Collection.size()


reverse

ListF<E> reverse()
List with elements in reverse order


uncheckedCast

<F> ListF<F> uncheckedCast()
Description copied from interface: CollectionF
Return this with another type parameter and no type checks.

Specified by:
uncheckedCast in interface CollectionF<E>
Specified by:
uncheckedCast in interface IterableF<E>

zip

<B> ListMap<E,B> zip(ListF<B> that)
List of pairs of elements with the same index in two lists