Maps { public static <E extends Enum<E>> Function<String, E> toEnum(Class<E> enumType) { return new Function<String, E>() { @Override public E apply(String name) { return Enum.valueOf(enumType, name); } @Override public String toString() { return "-> " + enumType.getName(); } }; } private  Maps(); static UnaryOperator<String> toLowerCase(final Locale locale); static UnaryOperator<String> toUpperCase(Locale locale); @Deprecated static Map<T, String> mapToString(); static Function<String, E> toEnum(Class<E> enumType); @Deprecated static UnaryOperator<T> identity(); @Deprecated static Function <F, T> constant(T v); @Deprecated static Function<K, V> map(java.util.Map<K, V> m); @SuppressWarnings("unchecked") static Map2<A, B, Pair<A, B>> toPair(); @Deprecated @SuppressWarnings("unchecked") static Map3<A, B, C, Tuple3<A, B, C>> toTuple3(); @Deprecated @SuppressWarnings("unchecked") static Map4<A, B, C, D, Tuple4<A, B, C, D>> toTuple4(); @SuppressWarnings("unchecked") @Deprecated static Map5<A, B, C, D, E, Tuple5<A, B, C, D, E>> toTuple5(); @Deprecated
  static final Function<String, Integer> TO_INTEGER; static UnaryOperator<String> TO_LOWER_CASE; static UnaryOperator<String> TO_UPPER_CASE; }
@Test public void testToEnum() { assertEquals(MyEnum.FOO, Maps.toEnum(MyEnum.class).apply("FOO")); assertEquals("-> " + MyEnum.class.getName(), Maps.toEnum(MyEnum.class).toString()); }