private static Function<Object[], Integer> getIndexGetter(final JavaMethod method) {
    if (method.getParameterCount() >= 1 && method.getParameterTypes()[0].equals(int.class)) {
      return s -> (Integer)s[0];
    }

    if (method.getParameterCount() == 2 && method.getParameterTypes()[1].equals(int.class)) {
      return s -> (Integer)s[1];
    }

    return new ConstantFunction<>(Integer.MAX_VALUE);
  }
private static Function<Object[], Integer> getIndexGetter(final JavaMethod method)