Advertisement
Guest User

Untitled

a guest
Jul 20th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.75 KB | None | 0 0
  1.     public static void main(String[] args) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
  2.         Method[] methods = Collections.class.getDeclaredMethods();
  3.         for (Method method : methods) {
  4.             if (Modifier.isStatic(method.getModifiers())
  5.                     && Modifier.isPublic(method.getModifiers())
  6.                     && method.getParameterCount() == 0 && List.class.isAssignableFrom(method.getReturnType())) {
  7.                 List list = (List) method.invoke(null);
  8.                 try {
  9.                     list.get(0);
  10.                 } catch (IndexOutOfBoundsException e) {
  11.                     System.out.println(list.getClass().getCanonicalName());
  12.                 }
  13.             }
  14.         }
  15.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement