--- old/makefiles/docs/CORE_PKGS.gmk 2012-10-31 12:58:52.938001285 -0700 +++ new/makefiles/docs/CORE_PKGS.gmk 2012-10-31 12:58:52.766001278 -0700 @@ -131,6 +131,7 @@ java.util.concurrent \ java.util.concurrent.atomic \ java.util.concurrent.locks \ + java.util.functions \ java.util.jar \ java.util.logging \ java.util.prefs \ --- /dev/null 2012-10-16 10:45:25.390681017 -0700 +++ new/src/share/classes/java/util/functions/BinaryOperator.java 2012-10-31 12:58:53.402001309 -0700 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2010, 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. + */ + +package java.util.functions; + +/** + * 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 /* extends Combiner */ { + + /** + * Returns the result of some operation upon the the 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-10-16 10:45:25.390681017 -0700 +++ new/src/share/classes/java/util/functions/Block.java 2012-10-31 12:58:54.010001337 -0700 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2010, 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. + */ + +package java.util.functions; + +/** + * 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 apply}. + * + * @since 1.8 + */ +public interface Block { + + /** + * Performs operations upon the provided object which may modify that object + * and/or external state. + * + * @param t an input object + */ + void apply(T t); +} --- /dev/null 2012-10-16 10:45:25.390681017 -0700 +++ new/src/share/classes/java/util/functions/DoubleBinaryOperator.java 2012-10-31 12:58:54.642001368 -0700 @@ -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.functions; + +/** + * Combines two {@code double} operands of the same type producing a + * {@code double} result. + * + * @since 1.8 + */ +public interface DoubleBinaryOperator { + /** + * Returns the result of some operation upon the operands. + * The parameters 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 double operate(double left, double right); +} --- /dev/null 2012-10-16 10:45:25.390681017 -0700 +++ new/src/share/classes/java/util/functions/DoubleMapper.java 2012-10-31 12:58:55.246001397 -0700 @@ -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.functions; + +/** + * Given an input object maps to an appropriate {@code double} value; this is + * the {@code double}-bearing specialization for {@link Mapper}. + * + * @param the type of input objects provided to the {@code map} operation. + * + * @since 1.8 + */ +public interface DoubleMapper { + + /** + * Map the provided input object to an appropriate {@code double} value. + * + * @param t the input object to be mapped. + * @return the mapped output value. + */ + double map(T t); +} --- /dev/null 2012-10-16 10:45:25.390681017 -0700 +++ new/src/share/classes/java/util/functions/DoubleUnaryOperator.java 2012-10-31 12:58:55.854001426 -0700 @@ -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.functions; + +/** + * Operator on a single {@code double} operand. + * + * @since 1.8 + */ +public interface DoubleUnaryOperator { + + /** + * Returns a {@code double} value computed from the double operand. + * + * @param operand The operand value. + * @return the computed result. + */ + public double operate(double operand); +} --- /dev/null 2012-10-16 10:45:25.390681017 -0700 +++ new/src/share/classes/java/util/functions/Factory.java 2012-10-31 12:58:56.466001457 -0700 @@ -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.functions; + +/** + * Returns an object. The returned object may be an existing object or a newly + * created object. + * + * @param The type of objects returned by {@code make}. + * + * @since 1.8 + */ +public interface Factory { + + /** + * Returns an object. + * + * @return an object. + */ + T make(); +} --- /dev/null 2012-10-16 10:45:25.390681017 -0700 +++ new/src/share/classes/java/util/functions/IntBinaryOperator.java 2012-10-31 12:58:57.074001486 -0700 @@ -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.functions; + +/** + * Combines two {@code int} operands of the same type producing an {@code int} + * result. + * + * @since 1.8 + */ +public interface IntBinaryOperator { + /** + * Returns the result of some operation upon the operands. + * The parameters are named {@code left} and {@code right} for operations + * where the order of parameters 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 int operate(int left, int right); +} --- /dev/null 2012-10-16 10:45:25.390681017 -0700 +++ new/src/share/classes/java/util/functions/IntMapper.java 2012-10-31 12:58:57.686001516 -0700 @@ -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.functions; + +/** + * Given an input object maps to an appropriate {@code int} value; this is the + * {@code int}-bearing specialization for {@link Mapper}. + * + * @param the type of input objects provided to the {@code map} operation. + * + * @since 1.8 + */ +public interface IntMapper { + + /** + * Map the provided input object to an appropriate {@code int} value. + * + * @param t the input object to be mapped. + * @return the mapped output value. + */ + int map(T t); +} --- /dev/null 2012-10-16 10:45:25.390681017 -0700 +++ new/src/share/classes/java/util/functions/IntUnaryOperator.java 2012-10-31 12:58:58.294001545 -0700 @@ -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.functions; + +/** + * Operator on a single {@code int} operand. + * + * @since 1.8 + */ +public interface IntUnaryOperator { + + /** + * Returns an {@code int} value computed from the {@code int} operand. + * + * @param operand The operand value. + * @return the computed result. + */ + public int operate(int operand); +} --- /dev/null 2012-10-16 10:45:25.390681017 -0700 +++ new/src/share/classes/java/util/functions/LongBinaryOperator.java 2012-10-31 12:58:58.906001574 -0700 @@ -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.functions; + +/** + * Combines two {@code long} operands of the same type producing a {@code long} + * result. + * + * @since 1.8 + */ +public interface LongBinaryOperator { + /** + * Returns the result of some operation upon the operands. + * The parameters 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 long operate(long left, long right); +} --- /dev/null 2012-10-16 10:45:25.390681017 -0700 +++ new/src/share/classes/java/util/functions/LongMapper.java 2012-10-31 12:58:59.522001605 -0700 @@ -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.functions; + +/** + * Given an input object maps to an appropriate {@code long} value; this is the + * {@code long}-bearing specialization for {@link Mapper}. + * + * @param the type of input objects provided to the {@code map} operation. + * + * @since 1.8 + */ +public interface LongMapper { + + /** + * Map the provided input object to an appropriate {@code long} value. + * + * @param t the input object to be mapped. + * @return the mapped output value. + */ + long map(T t); +} --- /dev/null 2012-10-16 10:45:25.390681017 -0700 +++ new/src/share/classes/java/util/functions/LongUnaryOperator.java 2012-10-31 12:59:00.130001634 -0700 @@ -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.functions; + +/** + * Operator on a single {@code long} operand. + * + * @since 1.8 + */ +public interface LongUnaryOperator { + + /** + * Returns a {@code long} value computed from the {@code long} operand. + * + * @param operand The operand value. + * @return the computed result. + */ + public long operate(long operand); +} --- /dev/null 2012-10-16 10:45:25.390681017 -0700 +++ new/src/share/classes/java/util/functions/Mapper.java 2012-10-31 12:59:00.738001664 -0700 @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2010, 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. + */ + +package java.util.functions; + +/** + * Given an input object maps to an appropriate output object. A mapper 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 map} operation. + * @param the type of output objects from {@code map} operation. May be the + * same type as {@code }. + * + * @since 1.8 + */ +public interface Mapper { + + /** + * Map the provided input object to an appropriate output object. + * + * @param t the input object to be mapped. + * @return the mapped output object. + */ + R map(T t); +} --- /dev/null 2012-10-16 10:45:25.390681017 -0700 +++ new/src/share/classes/java/util/functions/Predicate.java 2012-10-31 12:59:01.342001693 -0700 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2010, 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. + */ + +package java.util.functions; + +/** + * 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}. + */ + boolean test(T t); +} --- /dev/null 2012-10-16 10:45:25.390681017 -0700 +++ new/src/share/classes/java/util/functions/UnaryOperator.java 2012-10-31 12:59:01.954001723 -0700 @@ -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.functions; + +/** + * 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 Map */ { + + /** + * Returns a result computed from the provided operand. + * + * @param operand The operand. + * @return the computed result. + */ + public T operate(T operand); +} --- /dev/null 2012-10-16 10:45:25.390681017 -0700 +++ new/src/share/classes/java/util/functions/package-info.java 2012-10-31 12:59:02.558001752 -0700 @@ -0,0 +1,42 @@ +/* + * 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 methods. Each + * functional interface provides a single non-defaulted method to which the + * lambda method'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.functions;