
com.annimon.stream.function.UnaryOperator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of stream Show documentation
Show all versions of stream Show documentation
Stream API from Java 8 rewrited on iterators for Java 7 and below.
package com.annimon.stream.function;
/**
* Operation on a single operand that produces a result of the
* same type as its operand.
*
* @param the type of the operand and result of the operator
*/
@FunctionalInterface
public interface UnaryOperator extends Function {
class Util {
private Util() { }
/**
* Returns a unary operator that always returns its input argument.
*
* @param the type of the input and output of the operator
* @return a unary operator that always returns its input argument
*/
public static UnaryOperator identity() {
return new UnaryOperator() {
@Override
public T apply(T t) {
return t;
}
};
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy