/** * Creates a Criterion from the passed Criterion {@code name} if such an enum value exists, otherwise an empty * Optional. * * @param name the Criterion name to create the Criterion enum value of. * @return the optional Criterion. */ public static Optional<Criterion> forName(final String name) { return Stream.of(values()) // .filter(a -> Objects.equals(a.getName(), name)) // .findFirst(); }
/** * Creates a Criterion from the passed Criterion {@code name} if such an enum value exists, otherwise an empty * Optional. * * @param name the Criterion name to create the Criterion enum value of. * @return the optional Criterion. */ public static Optional<Criterion> forName(final String name) { return Stream.of(values()) // .filter(a -> Objects.equals(a.getName(), name)) // .findFirst(); }