The class java.lang.invoke.MethodHandles is enhanced in Java 9 to include more static methods for creating different kinds of method handles.
arrayConstructor
The method MethodHandle
arrayConstructor
(Class<?> arrayClass) returns
a method handle to construct arrays of the specified type arrayClass. The sole argument of the created method handle is an int value that specifies the size of the array, while the return value is the array. In Listing 9-1, I create a method handle to construct int[] arrays. Then I create an array of size 3 using the MethodHandle.
@Test
public void testArrayConstructor() throws ...