8001634: Initial set of functional interface types
Add the core functional interfaces used by the JSR335 libraries. Reviewed-by: dholmes, briangoetz, darcy
This commit is contained in:
parent
033919cce4
commit
8288138aac
jdk
make
src/share/classes/java/util/function
BinaryOperator.javaBlock.javaDoubleBinaryOperator.javaDoubleBlock.javaDoubleFunction.javaDoubleSupplier.javaDoubleUnaryOperator.javaFunction.javaIntBinaryOperator.javaIntBlock.javaIntFunction.javaIntSupplier.javaIntUnaryOperator.javaLongBinaryOperator.javaLongBlock.javaLongFunction.javaLongSupplier.javaLongUnaryOperator.javaPredicate.javaSupplier.javaUnaryOperator.javapackage-info.java
@ -131,6 +131,7 @@ CORE_PKGS = \
|
||||
java.util.concurrent \
|
||||
java.util.concurrent.atomic \
|
||||
java.util.concurrent.locks \
|
||||
java.util.function \
|
||||
java.util.jar \
|
||||
java.util.logging \
|
||||
java.util.prefs \
|
||||
|
@ -37,6 +37,8 @@ SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true
|
||||
JAVAC_MAX_WARNINGS=true
|
||||
include $(BUILDDIR)/common/Defs.gmk
|
||||
|
||||
AUTO_FILES_JAVA_DIRS = java/util/function
|
||||
|
||||
# windows compiler flags
|
||||
ifeq ($(PLATFORM),windows)
|
||||
OTHER_CFLAGS =
|
||||
|
47
jdk/src/share/classes/java/util/function/BinaryOperator.java
Normal file
47
jdk/src/share/classes/java/util/function/BinaryOperator.java
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2012 Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package java.util.function;
|
||||
|
||||
/**
|
||||
* An operation upon two operands yielding a result. The operands and the result
|
||||
* are all of the same type.
|
||||
*
|
||||
* @param <T> the type of operands to {@code operate} and of the result
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
public interface BinaryOperator<T> {
|
||||
|
||||
/**
|
||||
* Returns the result of the operation upon the operands.
|
||||
* The operands are named {@code left} and {@code right} for operations
|
||||
* where the order of operands matters.
|
||||
*
|
||||
* @param left the left operand
|
||||
* @param right the right operand
|
||||
* @return the result of the operation
|
||||
*/
|
||||
public T operate(T left, T right);
|
||||
}
|
44
jdk/src/share/classes/java/util/function/Block.java
Normal file
44
jdk/src/share/classes/java/util/function/Block.java
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2012 Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package java.util.function;
|
||||
|
||||
/**
|
||||
* An operation upon an input object. The operation may modify that object or
|
||||
* external state (other objects).
|
||||
*
|
||||
* @param <T> The type of input objects to {@code accept}
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
public interface Block<T> {
|
||||
|
||||
/**
|
||||
* Use the input object in operations which may modify that object or
|
||||
* external state (other objects).
|
||||
*
|
||||
* @param t the input object
|
||||
*/
|
||||
public void accept(T t);
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package java.util.function;
|
||||
|
||||
/**
|
||||
* An operation on two {@code double} operands yielding a {@code double} result.
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
public interface DoubleBinaryOperator /* extends BinaryOperator<Double> */ {
|
||||
//
|
||||
// @Override
|
||||
// public default Double operate(Double left, Double right) { return operateAsDouble((double) left, (double) right); }
|
||||
|
||||
/**
|
||||
* Returns the {@code double} result of the operation upon the
|
||||
* {@code double} operands. The parameters are named {@code left} and
|
||||
* {@code right} for operations where the order of parameters matters.
|
||||
*
|
||||
* @param left the left operand value
|
||||
* @param right the right operand value
|
||||
* @return the result of the operation
|
||||
*/
|
||||
public double operateAsDouble(double left, double right);
|
||||
}
|
45
jdk/src/share/classes/java/util/function/DoubleBlock.java
Normal file
45
jdk/src/share/classes/java/util/function/DoubleBlock.java
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2012 Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package java.util.function;
|
||||
|
||||
/**
|
||||
* An operation upon a {@code double} input value. The operation may modify
|
||||
* external state.
|
||||
*
|
||||
* <p/>This is the primitive type specialization of {@link Block} for
|
||||
* {@code double} and also may be used as a {@code Block<Double>}.
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
public interface DoubleBlock {
|
||||
|
||||
/**
|
||||
* Use the {@code double} input value in an operation which may modify
|
||||
* external state.
|
||||
*
|
||||
* @param t the input value
|
||||
*/
|
||||
public void accept(double t);
|
||||
}
|
45
jdk/src/share/classes/java/util/function/DoubleFunction.java
Normal file
45
jdk/src/share/classes/java/util/function/DoubleFunction.java
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package java.util.function;
|
||||
|
||||
/**
|
||||
* Apply a function to the input object yielding an appropriate {@code double}
|
||||
* value; this is the {@code double}-bearing specialization for {@link Function}.
|
||||
*
|
||||
* @param <T> the type of input objects to the function
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
public interface DoubleFunction<T> {
|
||||
|
||||
/**
|
||||
* Apply a function to the input object yielding an appropriate
|
||||
* {@code double} value.
|
||||
*
|
||||
* @param t the input object
|
||||
* @return the function result value
|
||||
*/
|
||||
public double applyAsDouble(T t);
|
||||
}
|
43
jdk/src/share/classes/java/util/function/DoubleSupplier.java
Normal file
43
jdk/src/share/classes/java/util/function/DoubleSupplier.java
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package java.util.function;
|
||||
|
||||
/**
|
||||
* A supplier of {@code double} values.
|
||||
*
|
||||
* <p/>This is the primitive type specialization of {@link Supplier} for
|
||||
* {@code double} and also may be used as a {@code Supplier<Double>}.
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
public interface DoubleSupplier {
|
||||
|
||||
/**
|
||||
* Returns a {@code double} value.
|
||||
*
|
||||
* @return a {@code double} value
|
||||
*/
|
||||
public double getAsDouble();
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package java.util.function;
|
||||
|
||||
/**
|
||||
* An operation on a single {@code double} operand yielding a {@code double}
|
||||
* result.
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
public interface DoubleUnaryOperator {
|
||||
|
||||
/**
|
||||
* Returns the {@code double} result of the operation upon the
|
||||
* {@code double} operand.
|
||||
*
|
||||
* @param operand the operand value
|
||||
* @return the operation result value
|
||||
*/
|
||||
public double operateAsDouble(double operand);
|
||||
}
|
47
jdk/src/share/classes/java/util/function/Function.java
Normal file
47
jdk/src/share/classes/java/util/function/Function.java
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2012 Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package java.util.function;
|
||||
|
||||
/**
|
||||
* Apply a function to the input object yielding an appropriate result object. A
|
||||
* function may variously provide a mapping between types, object instances or
|
||||
* keys and values or any other form of transformation upon the input.
|
||||
*
|
||||
* @param <T> the type of input objects to the {@code apply} operation
|
||||
* @param <R> the type of result objects from the {@code apply} operation. May
|
||||
* be the same type as {@code <T>}.
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
public interface Function<T, R> {
|
||||
|
||||
/**
|
||||
* Yield an appropriate result object for the input object.
|
||||
*
|
||||
* @param t the input object
|
||||
* @return the function result
|
||||
*/
|
||||
public R apply(T t);
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package java.util.function;
|
||||
|
||||
/**
|
||||
* An operation on two {@code int} operands yielding an {@code int} result.
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
public interface IntBinaryOperator {
|
||||
|
||||
/**
|
||||
* Returns the {@code int} result of the operation upon the {@code int}
|
||||
* operands. The parameters are named {@code left} and {@code right} for
|
||||
* operations where the order of parameters matters.
|
||||
*
|
||||
* @param left the left operand value
|
||||
* @param right the right operand value
|
||||
* @return the result of the operation
|
||||
*/
|
||||
public int operateAsInt(int left, int right);
|
||||
}
|
45
jdk/src/share/classes/java/util/function/IntBlock.java
Normal file
45
jdk/src/share/classes/java/util/function/IntBlock.java
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2012 Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package java.util.function;
|
||||
|
||||
/**
|
||||
* An operation upon an {@code int} input value. The operation may modify
|
||||
* external state.
|
||||
*
|
||||
* <p/>This is the primitive type specialization of {@link Block} for
|
||||
* {@code int} and also may be used as a {@code Block<Integer>}.
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
public interface IntBlock {
|
||||
|
||||
/**
|
||||
* Use the {@code int} input value in an operation which may modify external
|
||||
* state.
|
||||
*
|
||||
* @param t the input value
|
||||
*/
|
||||
public void accept(int t);
|
||||
}
|
45
jdk/src/share/classes/java/util/function/IntFunction.java
Normal file
45
jdk/src/share/classes/java/util/function/IntFunction.java
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package java.util.function;
|
||||
|
||||
/**
|
||||
* Apply a function to the input object yielding an appropriate {@code int}
|
||||
* value; this is the {@code int}-bearing specialization for {@link Function}.
|
||||
*
|
||||
* @param <T> the type of input objects to the function
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
public interface IntFunction<T> {
|
||||
|
||||
/**
|
||||
* Apply a function to the input object yielding an appropriate {@code int}
|
||||
* value.
|
||||
*
|
||||
* @param t the input object
|
||||
* @return the function result value
|
||||
*/
|
||||
public int applyAsInt(T t);
|
||||
}
|
43
jdk/src/share/classes/java/util/function/IntSupplier.java
Normal file
43
jdk/src/share/classes/java/util/function/IntSupplier.java
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package java.util.function;
|
||||
|
||||
/**
|
||||
* A supplier of {@code int} values.
|
||||
*
|
||||
* <p/>This is the primitive type specialization of {@link Supplier} for
|
||||
* {@code int} and also may be used as a {@code Supplier<Integer>}.
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
public interface IntSupplier {
|
||||
|
||||
/**
|
||||
* Returns an {@code int} value.
|
||||
*
|
||||
* @return an {@code int} value
|
||||
*/
|
||||
public int getAsInt();
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package java.util.function;
|
||||
|
||||
/**
|
||||
* An operation on a single {@code int} operand yielding an {@code int} result.
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
public interface IntUnaryOperator {
|
||||
|
||||
/**
|
||||
* Returns the {@code int} result of the operation upon the {@code int}
|
||||
* operand.
|
||||
*
|
||||
* @param operand the operand value
|
||||
* @return the operation result value
|
||||
*/
|
||||
public int operateAsInt(int operand);
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package java.util.function;
|
||||
|
||||
/**
|
||||
* An operation on two {@code long} operands yielding a {@code long} result.
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
public interface LongBinaryOperator {
|
||||
|
||||
/**
|
||||
* Returns the {@code long} result of the operation upon the {@code long}
|
||||
* operands. The parameters are named {@code left} and {@code right} for
|
||||
* operations where the order of parameters matters.
|
||||
*
|
||||
* @param left the left operand value
|
||||
* @param right the right operand value
|
||||
* @return the result of the operation
|
||||
*/
|
||||
public long operateAsLong(long left, long right);
|
||||
}
|
45
jdk/src/share/classes/java/util/function/LongBlock.java
Normal file
45
jdk/src/share/classes/java/util/function/LongBlock.java
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2012 Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package java.util.function;
|
||||
|
||||
/**
|
||||
* An operation upon a {@code long} input value. The operation may modify
|
||||
* external state.
|
||||
*
|
||||
* <p/>This is the primitive type specialization of {@link Block} for
|
||||
* {@code long} and also may be used as a {@code Block<Long>}.
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
public interface LongBlock {
|
||||
|
||||
/**
|
||||
* Use the {@code long} input value in an operation which may modify
|
||||
* external state.
|
||||
*
|
||||
* @param t the input value
|
||||
*/
|
||||
public void accept(long t);
|
||||
}
|
45
jdk/src/share/classes/java/util/function/LongFunction.java
Normal file
45
jdk/src/share/classes/java/util/function/LongFunction.java
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package java.util.function;
|
||||
|
||||
/**
|
||||
* Apply a function to the input object yielding an appropriate {@code long}
|
||||
* value; this is the {@code long}-bearing specialization for {@link Function}.
|
||||
*
|
||||
* @param <T> the type of input objects to the function
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
public interface LongFunction<T> {
|
||||
|
||||
/**
|
||||
* Apply a function to the input object yielding an appropriate {@code long}
|
||||
* value.
|
||||
*
|
||||
* @param t the input object
|
||||
* @return the function result value
|
||||
*/
|
||||
public long applyAsLong(T t);
|
||||
}
|
43
jdk/src/share/classes/java/util/function/LongSupplier.java
Normal file
43
jdk/src/share/classes/java/util/function/LongSupplier.java
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package java.util.function;
|
||||
|
||||
/**
|
||||
* A supplier of {@code long} values.
|
||||
*
|
||||
* <p/>This is the primitive type specialization of {@link Supplier} for
|
||||
* {@code long} and also may be used as a {@code Supplier<Long>}.
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
public interface LongSupplier {
|
||||
|
||||
/**
|
||||
* Returns a {@code long} value.
|
||||
*
|
||||
* @return a {@code long} value.
|
||||
*/
|
||||
public long getAsLong();
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package java.util.function;
|
||||
|
||||
/**
|
||||
* An operation on a single {@code long} operand yielding a {@code long} result.
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
public interface LongUnaryOperator {
|
||||
|
||||
/**
|
||||
* Returns the {@code long} result of the operation upon the {@code long}
|
||||
* operand.
|
||||
*
|
||||
* @param operand the operand value
|
||||
* @return the operation result value
|
||||
*/
|
||||
public long operateAsLong(long operand);
|
||||
}
|
44
jdk/src/share/classes/java/util/function/Predicate.java
Normal file
44
jdk/src/share/classes/java/util/function/Predicate.java
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2012 Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package java.util.function;
|
||||
|
||||
/**
|
||||
* Determines if the input object matches some criteria.
|
||||
*
|
||||
* @param <T> the type of input objects to {@code test}
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
public interface Predicate<T> {
|
||||
|
||||
/**
|
||||
* Returns {@code true} if the input object matches some criteria.
|
||||
*
|
||||
* @param t the input object
|
||||
* @return {@code true} if the input object matches some criteria, otherwise
|
||||
* {@code false}
|
||||
*/
|
||||
public boolean test(T t);
|
||||
}
|
43
jdk/src/share/classes/java/util/function/Supplier.java
Normal file
43
jdk/src/share/classes/java/util/function/Supplier.java
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package java.util.function;
|
||||
|
||||
/**
|
||||
* A supplier of objects. The result objects are either created during the
|
||||
* invocation of {@link #get} or by some prior action.
|
||||
*
|
||||
* @param <T> The type of objects returned by {@code get}
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
public interface Supplier<T> {
|
||||
|
||||
/**
|
||||
* Returns an object.
|
||||
*
|
||||
* @return an object
|
||||
*/
|
||||
public T get();
|
||||
}
|
44
jdk/src/share/classes/java/util/function/UnaryOperator.java
Normal file
44
jdk/src/share/classes/java/util/function/UnaryOperator.java
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package java.util.function;
|
||||
|
||||
/**
|
||||
* An operation upon a single operand yielding a result. The operand and the
|
||||
* result are of the same type.
|
||||
*
|
||||
* @param <T> the type of operand to {@code operate} and of the result
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
public interface UnaryOperator<T> {
|
||||
|
||||
/**
|
||||
* Returns the result of the operation upon the operand.
|
||||
*
|
||||
* @param operand the operand
|
||||
* @return the operation result
|
||||
*/
|
||||
public T operate(T operand);
|
||||
}
|
48
jdk/src/share/classes/java/util/function/package-info.java
Normal file
48
jdk/src/share/classes/java/util/function/package-info.java
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
/**
|
||||
* <em>Functional interfaces</em> provide typing for lambda expressions. Each
|
||||
* functional interface provides a single abstract method to which the lambda
|
||||
* expression's parameter and return types are matched.
|
||||
*
|
||||
* <p>The interfaces in this package are all functional interfaces used with the
|
||||
* collections and streams frameworks. The operation identified by each
|
||||
* interface is generally applied to a collection or stream of objects.
|
||||
*
|
||||
* <p>All functional interface implementations are expected to ensure that:
|
||||
* <ul>
|
||||
* <li>When used for aggregate operations upon many elements it should not be
|
||||
* assumed that the operation will be called upon elements in any specific order.
|
||||
* </li>
|
||||
* <li>{@code null} values are accepted and returned by these functional
|
||||
* interfaces according to the constraints of the specification in which the
|
||||
* functional interfaces are used. The functional interfaces themselves do not
|
||||
* constrain or mandate use of {@code null} values. Most usages of the
|
||||
* functional interfaces will define the role, if any, of {@code null} for that
|
||||
* context.
|
||||
* </li>
|
||||
* </ul>
|
||||
*/
|
||||
package java.util.function;
|
Loading…
x
Reference in New Issue
Block a user