
com.aol.cyclops.lambda.tuple.Extractors Maven / Gradle / Ivy
The newest version!
package com.aol.cyclops.lambda.tuple;
import java.util.Iterator;
import com.aol.cyclops.matcher.Extractor;
public class Extractors {
/**
* @return An extractor that generates a PTuple from an iterable, extracts the first 2 values to create a PTuple2
*/
public final static Extractor> toPTuple2(){
return ( Iterable itable)-> {
Iterator it = itable.iterator();
return new TupleImpl(it,2);//(it.next(),it.next());
};
}
/**
* @return An extractor that generates a PTuple from an iterable, extracts the first 3 values to create a PTuple3
*/
public final static Extractor> toPTuple3(){
return ( Iterable itable)-> {
Iterator it = itable.iterator();
return new TupleImpl(it,3);
};
}
/**
* @return An extractor that generates a PTuple from an iterable, extracts the first 4 values to create a PTuple4
*/
public final static Extractor> toPTuple4(){
return ( Iterable itable)-> {
Iterator it = itable.iterator();
return new TupleImpl(it,4);
};
}
/**
* @return An extractor that generates a PTuple from an iterable, extracts the first 5 values to create a PTuple5
*/
public final static Extractor> toPTuple5(){
return ( Iterable itable)-> {
Iterator it = itable.iterator();
return new TupleImpl(it,5);
};
}
/**
* @return An extractor that generates a PTuple from an iterable, extracts the first 6 values to create a PTuple6
*/
public final static Extractor> toPTuple6(){
return ( Iterable itable)-> {
Iterator it = itable.iterator();
return new TupleImpl(it,6);
};
}
/**
* @return An extractor that generates a PTuple from an iterable, extracts the first 7 values to create a PTuple7
*/
public final static Extractor> toPTuple7(){
return ( Iterable itable)-> {
Iterator it = itable.iterator();
return new TupleImpl(it,7);
};
}
/**
* @return An extractor that generates a PTuple from an iterable, extracts the first 8 values to create a PTuple8
*/
public final static Extractor> toPTuple8(){
return ( Iterable itable)-> {
Iterator it = itable.iterator();
return new TupleImpl(it,8);
};
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy