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

me.shaftesbury.utils.functional.Iterable2 Maven / Gradle / Ivy

There is a newer version: 1.17
Show newest version
package me.shaftesbury.utils.functional;

import org.javatuples.Pair;
import org.javatuples.Triplet;

import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * Created with IntelliJ IDEA.
 * User: Bob
 * Date: 01/12/13
 * Time: 23:31
 * To change this template use File | Settings | File Templates.
 */
public interface Iterable2 extends java.lang.Iterable
{
    Iterable2 filter(Func f);
    Iterable2 map(Func f);
     Iterable2 mapi(final Func2 f);
    Iterable2 choose(Func> f);
    boolean exists(Func f);
    boolean forAll(Func f);
    boolean forAll2(final Func2 f, final Iterable input1);
    U fold(Func2 f, U seed);
    List toList();
    Object[] toArray();
    Set toSet();
    Map toDictionary(final Func keyFn, final Func valueFn);
    T last();
    Iterable2 sortWith(final Comparator f);
    Iterable2 concat(final Iterable2 list2);
    T find(Func f);
    int findIndex(Func f);
    U pick(final Func> f);
    Iterable2 collect(final Func> f);

    Iterable2 take(final int howMany);
    Iterable2 skip(final int howMany);

    String join(final String delimiter);
    T findLast(final Func f);
    Pair,List> partition(final Func f);

    Iterable2> zip(final Iterable2 l2);
    //org.javatuples.Pair,List> unzip();
    Iterable2> zip3(final Iterable l2, final Iterable l3);
    U in(final Func, U> f);

    Map> groupBy(final Func keyFn);
}