< prev index next >
src/java.base/share/classes/java/lang/invoke/MethodHandle.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2008, 2016, 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
--- 1,7 ----
/*
! * Copyright (c) 2008, 2017, 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
*** 887,897 ****
* {@code arrayLength} parameters of the target's type, starting at the zero-based position {@code spreadArgPos},
* are replaced by a single array parameter of type {@code arrayType}.
* <p>
* This method behaves very much like {@link #asSpreader(Class, int)}, but accepts an additional {@code spreadArgPos}
* argument to indicate at which position in the parameter list the spreading should take place.
! * <p>
* @apiNote Example:
* <blockquote><pre>{@code
MethodHandle compare = LOOKUP.findStatic(Objects.class, "compare", methodType(int.class, Object.class, Object.class, Comparator.class));
MethodHandle compare2FromArray = compare.asSpreader(0, Object[].class, 2);
Object[] ints = new Object[]{3, 9, 7, 7};
--- 887,897 ----
* {@code arrayLength} parameters of the target's type, starting at the zero-based position {@code spreadArgPos},
* are replaced by a single array parameter of type {@code arrayType}.
* <p>
* This method behaves very much like {@link #asSpreader(Class, int)}, but accepts an additional {@code spreadArgPos}
* argument to indicate at which position in the parameter list the spreading should take place.
! *
* @apiNote Example:
* <blockquote><pre>{@code
MethodHandle compare = LOOKUP.findStatic(Objects.class, "compare", methodType(int.class, Object.class, Object.class, Comparator.class));
MethodHandle compare2FromArray = compare.asSpreader(0, Object[].class, 2);
Object[] ints = new Object[]{3, 9, 7, 7};
*** 1092,1102 ****
* is replaced by {@code arrayLength} parameters whose type is element type of {@code arrayType}.
* <p>
* This method behaves very much like {@link #asCollector(Class, int)}, but differs in that its {@code
* collectArgPos} argument indicates at which position in the parameter list arguments should be collected. This
* index is zero-based.
! * <p>
* @apiNote Examples:
* <blockquote><pre>{@code
StringWriter swr = new StringWriter();
MethodHandle swWrite = LOOKUP.findVirtual(StringWriter.class, "write", methodType(void.class, char[].class, int.class, int.class)).bindTo(swr);
MethodHandle swWrite4 = swWrite.asCollector(0, char[].class, 4);
--- 1092,1102 ----
* is replaced by {@code arrayLength} parameters whose type is element type of {@code arrayType}.
* <p>
* This method behaves very much like {@link #asCollector(Class, int)}, but differs in that its {@code
* collectArgPos} argument indicates at which position in the parameter list arguments should be collected. This
* index is zero-based.
! *
* @apiNote Examples:
* <blockquote><pre>{@code
StringWriter swr = new StringWriter();
MethodHandle swWrite = LOOKUP.findVirtual(StringWriter.class, "write", methodType(void.class, char[].class, int.class, int.class)).bindTo(swr);
MethodHandle swWrite4 = swWrite.asCollector(0, char[].class, 4);
< prev index next >