net.sf.molae.pipe.binop
Class ElementwiseCollection<E,S1 extends E,S2>
java.lang.Object
java.util.AbstractCollection<E>
net.sf.molae.pipe.binop.ElementwiseCollection<E,S1,S2>
- All Implemented Interfaces:
- Iterable<E>, Collection<E>
public final class ElementwiseCollection<E,S1 extends E,S2>
- extends AbstractCollection<E>
Performs a binary operation on every pair of elements from two collections.
Methods inherited from class java.util.AbstractCollection |
add, addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString |
ElementwiseCollection
public ElementwiseCollection(BinaryFunction<? super S1,? super S2,? extends E> operation,
Collection<S1> base1,
Collection<S2> base2)
- Constructs a computed collection from the specified collections and
operation.
- Parameters:
operation
- the underlying binary functionbase1
- the collection containing the first operands of the
underlying operation.base2
- the collection containing the second operands of the
underlying operation.
- Throws:
NullPointerException
- if any argument is null
or if the specified operation has no permuted function.
newInstance
public static <E,S1 extends E,S2> ElementwiseCollection<E,S1,S2> newInstance(BinaryFunction<? super S1,? super S2,E> operation,
Collection<S1> base1,
Collection<S2> base2)
- Constructs a computed collection from the specified collections and
operation.
- Parameters:
operation
- the underlying binary functionbase1
- the collection containing the first operands of the
underlying operation.base2
- the collection containing the second operands of the
underlying operation.
- Throws:
NullPointerException
- if any argument is null
or if the specified operation has no permuted function.- Since:
- 2.0
size
public int size()
- Specified by:
size
in interface Collection<E>
- Specified by:
size
in class AbstractCollection<E>
iterator
public Iterator<E> iterator()
- Specified by:
iterator
in interface Iterable<E>
- Specified by:
iterator
in interface Collection<E>
- Specified by:
iterator
in class AbstractCollection<E>