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

com.annimon.stream.function.UnaryOperator Maven / Gradle / Ivy

There is a newer version: 1.2.2
Show newest version
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