JBIterable<TreeTraversal> () { JBIterable<TreeTraversal> result = JBIterable.of(TreeTraversal.class.getDeclaredFields()) .filter(o -> Modifier.isStatic(o.getModifiers()) && Modifier.isPublic(o.getModifiers())) .map(o -> { try { return o.get(null); } catch (IllegalAccessException e) { throw new AssertionError(e); } }) .filter(TreeTraversal.class) .sort(Comparator.comparing(Object::toString)) .collect(); assertEquals("[BI_ORDER_DFS, INTERLEAVED_DFS, LEAVES_BFS, LEAVES_DFS," + " PLAIN_BFS, POST_ORDER_DFS, PRE_ORDER_DFS, TRACING_BFS]", result.toList().toString()); return result; }