--- old/make/docs/CORE_PKGS.gmk 2012-11-19 20:43:39.526654196 -0800 +++ new/make/docs/CORE_PKGS.gmk 2012-11-19 20:43:39.338654187 -0800 @@ -131,6 +131,7 @@ java.util.concurrent \ java.util.concurrent.atomic \ java.util.concurrent.locks \ + java.util.function \ java.util.jar \ java.util.logging \ java.util.prefs \ --- old/make/java/java/Makefile 2012-11-19 20:43:40.178654227 -0800 +++ new/make/java/java/Makefile 2012-11-19 20:43:39.990654218 -0800 @@ -37,6 +37,8 @@ JAVAC_MAX_WARNINGS=true include $(BUILDDIR)/common/Defs.gmk +AUTO_FILES_JAVA_DIRS = java/util/functions + # windows compiler flags ifeq ($(PLATFORM),windows) OTHER_CFLAGS = --- /dev/null 2012-11-16 09:11:27.403150018 -0800 +++ new/src/share/classes/java/util/function/BinaryOperator.java 2012-11-19 20:43:40.650654250 -0800 @@ -0,0 +1,46 @@ +/* + * 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; + +/** + * Combines two operands of the same type producing a result of the same type. + * + * @param the type of input objects to {@code operate} and of the result. + * + * @since 1.8 + */ +public interface BinaryOperator { + + /** + * Returns the result of some binary operation upon the provided operands. + * The operands are named {@code left} and {@code right} for operations + * where the order of operands matters. + * + * @param left input object used as the left operand + * @param right input object used as the right operand + * @return result of the operation + */ + public T operate(T left, T right); +} --- /dev/null 2012-11-16 09:11:27.403150018 -0800 +++ new/src/share/classes/java/util/function/Block.java 2012-11-19 20:43:41.282654281 -0800 @@ -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; + +/** + * Performs operations upon an input object which may modify that object and/or + * external state (other objects). + * + * @param The type of input objects to {@code accept}. + * + * @since 1.8 + */ +public interface Block { + + /** + * Performs operations upon the provided object which may modify that object + * and/or external state. + * + * @param t the input object + */ + public void accept(T t); +} --- /dev/null 2012-11-16 09:11:27.403150018 -0800 +++ new/src/share/classes/java/util/function/DoubleBinaryOperator.java 2012-11-19 20:43:41.910654311 -0800 @@ -0,0 +1,55 @@ +/* + * 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; + +/** + * Combines two {@code double} operands producing an {@code double} result. + * + * @since 1.8 + */ +public interface DoubleBinaryOperator /* extends BinaryOperator */ { +// +// /** +// * Returns the result of some binary operation upon the operands. The +// * parameters 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 result of the operation +// */ +// public default Double operate(Double left, Double right) { return operateAsDouble((double) left, (double) right); } + + /** + * Returns the result of some binary operation upon the operands. The + * parameters are named {@code left} and {@code right} for operations where + * the order of operands matters. + * + * @param left value used as the left operand + * @param rightvalue used as the right operand + * @return result value of the operation + */ + public double operateAsDouble(double left, double right); +} --- /dev/null 2012-11-16 09:11:27.403150018 -0800 +++ new/src/share/classes/java/util/function/DoubleBlock.java 2012-11-19 20:43:42.542654342 -0800 @@ -0,0 +1,53 @@ +/* + * 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; + +/** + * Performs operations upon an input object which may modify that object and/or + * external state (other objects). + * + * @param The type of input objects to {@code accept}. + * + * @since 1.8 + */ +public interface DoubleBlock /* extends Block */ { +// +// /** +// * Performs operations upon the provided {@code Double} which may modify +// * external state. +// * +// * @param t the input +// */ +// @Override +// public default void accept(Double t) { accept((double) t); } + + /** + * Performs operations upon the provided object which may modify that object + * and/or external state. + * + * @param t the input value + */ + public void accept(double t); +} --- /dev/null 2012-11-16 09:11:27.403150018 -0800 +++ new/src/share/classes/java/util/function/DoubleFunction.java 2012-11-19 20:43:43.170654372 -0800 @@ -0,0 +1,56 @@ +/* + * 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 the type of input objects to the {@code apply} operation. + * + * @since 1.8 + */ +public interface DoubleFunction /* extends Function */ { +// +// /** +// * Apply a function to the input object yielding an appropriate +// * {@code Double}. +// * +// * @param t the input object to the function +// * @return the function output {@code Double} +// */ +// @Override +// public default Double apply(T t) { return applyAsDouble(t); } + + /** + * Apply a function to the input object yielding an appropriate + * {@code double} value. + * + * @param t the input object to the function + * @return the function output value + */ + public double applyAsDouble(T t); +} --- /dev/null 2012-11-16 09:11:27.403150018 -0800 +++ new/src/share/classes/java/util/function/DoubleSupplier.java 2012-11-19 20:43:43.802654403 -0800 @@ -0,0 +1,48 @@ +/* + * 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; + +/** + * Supplies a {@code double} value or {@code Double}. + * + * @since 1.8 + */ +public interface DoubleSupplier /* extends Supplier */ { +// +// /** +// * Returns a {@code Double}. +// * +// * @return the {@code Double} +// */ +// @Override +// public default Double get() { return getAsDouble(); } + + /** + * Returns a {@code double} value. + * + * @return the value + */ + public double getAsDouble(); +} --- /dev/null 2012-11-16 09:11:27.403150018 -0800 +++ new/src/share/classes/java/util/function/DoubleUnaryOperator.java 2012-11-19 20:43:44.430654433 -0800 @@ -0,0 +1,50 @@ +/* + * 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; + +/** + * Operator on a single {@code double} operand. + * + * @since 1.8 + */ +public interface DoubleUnaryOperator /* extends UnaryOperator */ { +// +// /** +// * Returns a {@code Double} computed from the {@code double} operand. +// * +// * @param operand the operand +// * @return the computed result +// */ +// @Override +// public default Double operate(Double operand) { return operateAsDouble((double) operand); } + + /** + * Returns a {@code double} value computed from the {@code double} operand. + * + * @param operand the operand value + * @return the computed result + */ + public double operateAsDouble(double operand); +} --- /dev/null 2012-11-16 09:11:27.403150018 -0800 +++ new/src/share/classes/java/util/function/Function.java 2012-11-19 20:43:45.058654464 -0800 @@ -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 output 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 the type of input objects provided to the {@code apply} operation. + * @param the type of output objects from {@code apply} operation. May be + * the same type as {@code }. + * + * @since 1.8 + */ +public interface Function { + + /** + * Yield an appropriate output object for the provided input object. + * + * @param t the input object to be to which the function will be applied. + * @return the function output object + */ + public R apply(T t); +} --- /dev/null 2012-11-16 09:11:27.403150018 -0800 +++ new/src/share/classes/java/util/function/IntBinaryOperator.java 2012-11-19 20:43:45.686654494 -0800 @@ -0,0 +1,56 @@ +/* + * 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; + +/** + * Combines two {@code int} operands producing an {@code int} result. + * + * @since 1.8 + */ +public interface IntBinaryOperator /* extends BinaryOperator */ { +// +// /** +// * Returns the result of some binary operation upon the operands. The +// * parameters are named {@code left} and {@code right} for operations where +// * the order of parameters matters. +// * +// * @param left the left operand +// * @param right the right operand +// * @return result of the operation +// */ +// @Override +// public default Integer operate(Integer left, Integer right) { return operateAsInt((int) left, (int) right); } + + /** + * Returns the result of some binary operation upon the operands. The + * parameters are named {@code left} and {@code right} for operations where + * the order of parameters matters. + * + * @param left value used as the left operand + * @param right value used as the right operand + * @return result value of the operation + */ + public int operateAsInt(int left, int right); +} --- /dev/null 2012-11-16 09:11:27.403150018 -0800 +++ new/src/share/classes/java/util/function/IntBlock.java 2012-11-19 20:43:46.314654524 -0800 @@ -0,0 +1,53 @@ +/* + * 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; + +/** + * Performs operations upon an input object which may modify that object and/or + * external state (other objects). + * + * @param The type of input objects to {@code accept}. + * + * @since 1.8 + */ +public interface IntBlock /* extends Block */ { +// +// /** +// * Performs operations upon the provided {@code Integer} which may modify +// * external state. +// * +// * @param t the input +// */ +// @Override +// public default void accept(Integer t) { return accept((int) t); } + + /** + * Performs operations upon the provided object which may modify that object + * and/or external state. + * + * @param t the input value + */ + public void accept(int t); +} --- /dev/null 2012-11-16 09:11:27.403150018 -0800 +++ new/src/share/classes/java/util/function/IntFunction.java 2012-11-19 20:43:46.942654555 -0800 @@ -0,0 +1,55 @@ +/* + * 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 the type of input objects to the {@code apply} operation. + * + * @since 1.8 + */ +public interface IntFunction /* extends Function */ { +// +// /** +// * Apply a function to the input object yielding an appropriate +// * {@code Integer}. +// * +// * @param t the input object to the function +// * @return the function output {@code Integer} +// */ +// @Override +// public default Integer apply(T t) { return applyAsInt(); } + + /** + * Apply a function to the input object yielding an appropriate {@code int} + * value. + * + * @param t the input object to the function + * @return the function output value + */ + public int applyAsInt(T t); +} --- /dev/null 2012-11-16 09:11:27.403150018 -0800 +++ new/src/share/classes/java/util/function/IntSupplier.java 2012-11-19 20:43:47.574654585 -0800 @@ -0,0 +1,48 @@ +/* + * 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; + +/** + * Supplies a {@code int} value or {@code Integer}. + * + * @since 1.8 + */ +public interface IntSupplier /* extends Supplier */ { +// +// /** +// * Returns an {@code Integer}. +// * +// * @return the {@code Integer}. +// */ +// @Override +// public default Integer get() { return getAsInt(); } + + /** + * Returns an {@code int} value. + * + * @return the value + */ + public int getAsInt(); +} --- /dev/null 2012-11-16 09:11:27.403150018 -0800 +++ new/src/share/classes/java/util/function/IntUnaryOperator.java 2012-11-19 20:43:48.198654616 -0800 @@ -0,0 +1,50 @@ +/* + * 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; + +/** + * Operator on a single {@code int} operand. + * + * @since 1.8 + */ +public interface IntUnaryOperator /* extends UnaryOperator */ { +// +// /** +// * Returns an {@code Integer} computed from the {@code Integer} operand. +// * +// * @param operand the operand value +// * @return the computed result +// */ +// @Override +// public default Integer operate(Integer operand) { return operate((int) operand); } + + /** + * Returns an {@code int} value computed from the {@code int} operand. + * + * @param operand the operand value + * @return the computed result + */ + public int operateAsInt(int operand); +} --- /dev/null 2012-11-16 09:11:27.403150018 -0800 +++ new/src/share/classes/java/util/function/LongBinaryOperator.java 2012-11-19 20:43:48.830654646 -0800 @@ -0,0 +1,56 @@ +/* + * 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; + +/** + * Combines two {@code long} operands producing an {@code long} result. + * + * @since 1.8 + */ +public interface LongBinaryOperator /* extends BinaryOperator */ { +// +// /** +// * Returns the result of some binary operation upon the operands. The +// * parameters 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 result of the operation +// */ +// @Override +// public default Long operate(Long left, Long right) { return operateAsLong((long) left, (long) right); } + + /** + * Returns the result of some binary operation upon the operands. The + * parameters are named {@code left} and {@code right} for operations where + * the order of operands matters. + * + * @param left value used as the left operand + * @param right value used as the right operand + * @return result value of the operation + */ + public long operateAsLong(long left, long right); +} --- /dev/null 2012-11-16 09:11:27.403150018 -0800 +++ new/src/share/classes/java/util/function/LongBlock.java 2012-11-19 20:43:49.458654677 -0800 @@ -0,0 +1,53 @@ +/* + * 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; + +/** + * Performs operations upon an input object which may modify that object and/or + * external state (other objects). + * + * @param The type of input objects to {@code accept}. + * + * @since 1.8 + */ +public interface LongBlock /* extends Block */ { +// +// /** +// * Performs operations upon the provided {@code Long} which may modify +// * external state. +// * +// * @param t the input +// */ +// @Override +// public default void accept(Long t) { return accept((long) t); } + + /** + * Performs operations upon the provided object which may modify that object + * and/or external state. + * + * @param t the input value + */ + public void accept(long t); +} --- /dev/null 2012-11-16 09:11:27.403150018 -0800 +++ new/src/share/classes/java/util/function/LongFunction.java 2012-11-19 20:43:50.086654707 -0800 @@ -0,0 +1,55 @@ +/* + * 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 the type of input objects to the {@code apply} operation. + * + * @since 1.8 + */ +public interface LongFunction /* extends Function */ { +// +// /** +// * Apply a function to the input object yielding an appropriate +// * {@code Long}. +// * +// * @param t the input object to the function +// * @return the function output {@code Long} +// */ +// @Override +// public default Long apply(T t) { return applyAsLong(t); } + + /** + * Apply a function to the input object yielding an appropriate {@code long} + * value. + * + * @param t the input object to the function + * @return the function output value + */ + public long applyAsLong(T t); +} --- /dev/null 2012-11-16 09:11:27.403150018 -0800 +++ new/src/share/classes/java/util/function/LongSupplier.java 2012-11-19 20:43:50.714654737 -0800 @@ -0,0 +1,48 @@ +/* + * 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; + +/** + * Supplies a {@code long} value or {@code Long}. + * + * @since 1.8 + */ +public interface LongSupplier /* extends Supplier */ { +// +// /** +// * Returns a {@code Long} value. +// * +// * @return the value +// */ +// @Override +// public default Long get() { return getAsLong(); } + + /** + * Returns a {@code long} value. + * + * @return the value + */ + public long getAsLong(); +} --- /dev/null 2012-11-16 09:11:27.403150018 -0800 +++ new/src/share/classes/java/util/function/LongUnaryOperator.java 2012-11-19 20:43:51.342654768 -0800 @@ -0,0 +1,50 @@ +/* + * 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; + +/** + * Operator on a single {@code long} operand. + * + * @since 1.8 + */ +public interface LongUnaryOperator /* extends UnaryOperator */ { +// +// /** +// * Returns a {@code Long} computed from the {@code Long} operand. +// * +// * @param operand the operand value +// * @return the computed result +// */ +// @Override +// public default Long operate(Long operand) { return operateAsLong((long) operand); } + + /** + * Returns a {@code long} value computed from the {@code long} operand. + * + * @param operand the operand value + * @return the computed result + */ + public long operateAsLong(long operand); +} --- /dev/null 2012-11-16 09:11:27.403150018 -0800 +++ new/src/share/classes/java/util/function/Predicate.java 2012-11-19 20:43:51.970654798 -0800 @@ -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 the type of input objects provided to {@code test}. + * + * @since 1.8 + */ +public interface Predicate { + + /** + * Return {@code true} if the input object matches some criteria. + * + * @param t the input object + * @return {@code true} if the input object matched some criteria otherwise + * {@code false} + */ + public boolean test(T t); +} --- /dev/null 2012-11-16 09:11:27.403150018 -0800 +++ new/src/share/classes/java/util/function/Supplier.java 2012-11-19 20:43:52.598654829 -0800 @@ -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; + +/** + * Returns an object, either created during the invocation of {@code get} or by + * some prior action. + * + * @param The type of objects returned by {@code get}. + * + * @since 1.8 + */ +public interface Supplier { + + /** + * Returns an object. + * + * @return an object + */ + public T get(); +} --- /dev/null 2012-11-16 09:11:27.403150018 -0800 +++ new/src/share/classes/java/util/function/UnaryOperator.java 2012-11-19 20:43:53.226654860 -0800 @@ -0,0 +1,46 @@ +/* + * 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; + +/** + * Operator on a single operand. + * + * @param the type of input objects to {@code operate} and of the result. + * + * @since 1.8 + */ +public interface UnaryOperator /* extends Function */ { +// +// @Override +// public default T apply(T operand) { return operate(operand); } + + /** + * Returns a result computed from the provided operand. + * + * @param operand the operand + * @return the computed result + */ + public T operate(T operand); +} --- /dev/null 2012-11-16 09:11:27.403150018 -0800 +++ new/src/share/classes/java/util/function/package-info.java 2012-11-19 20:43:53.854654889 -0800 @@ -0,0 +1,41 @@ +/* + * 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. + */ +/** + * Functional interfaces 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. + * + *

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. + * + *

All functional interface implementations are expected to: + *

    + *
  • 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. + *
  • + *
+ */ +package java.util.function;