1 /* |
1 /* |
2 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
28 * and method references. Each functional interface has a single abstract method |
28 * and method references. Each functional interface has a single abstract method |
29 * to which the lambda expression's parameter and return types are matched or |
29 * to which the lambda expression's parameter and return types are matched or |
30 * adapted. Functional interfaces can provide a target type in multiple contexts, |
30 * adapted. Functional interfaces can provide a target type in multiple contexts, |
31 * such as assignment context, method invocation, or cast context: |
31 * such as assignment context, method invocation, or cast context: |
32 * |
32 * |
33 * <pre> |
33 * <pre>{@code |
34 * Predicate<String> p = String::isEmpty; |
34 * Predicate<String> p = String::isEmpty; |
35 * |
35 * |
36 * stream.filter(e -> e.getSize() > 10)... |
36 * stream.filter(e -> e.getSize() > 10)... |
37 * |
37 * |
38 * stream.map((ToIntFunction) e -> e.getSize())... |
38 * stream.map((ToIntFunction) e -> e.getSize())... |
39 * </pre> |
39 * }</pre> |
40 * |
40 * |
41 * <p>The interfaces in this package are functional interfaces used by the JDK, |
41 * <p>The interfaces in this package are functional interfaces used by the JDK, |
42 * and are available to be used by user code as well. While they do not identify |
42 * and are available to be used by user code as well. While they do not identify |
43 * a complete set of function shapes to which lambda expressions might be adapted, |
43 * a complete set of function shapes to which lambda expressions might be adapted, |
44 * they provide enough to cover common requirements. |
44 * they provide enough to cover common requirements. |