private static MethodHandle[] makeLists() { ArrayList<MethodHandle> mhs = new ArrayList<>(); for (; ; ) { MethodHandle mh = findCollector("list", mhs.size(), List.class); if (mh == null) break; mhs.add(mh); } assert (mhs.size() == 11); // current number of methods return mhs.toArray(new MethodHandle[MAX_ARITY + 1]); }
private static MethodHandle[] makeFillArrays() { ArrayList<MethodHandle> mhs = new ArrayList<>(); mhs.add(null); // there is no empty fill; at least a0 is required for (; ; ) { MethodHandle mh = findCollector("fillArray", mhs.size(), Object[].class, Integer.class, Object[].class); if (mh == null) break; mhs.add(mh); } assert (mhs.size() == 11); // current number of methods return mhs.toArray(new MethodHandle[0]); }