/** * Returns the {@code ConnectionType} for the given {@code name} if it exists. * * @param name the name. * @return the ConnectionType or an empty optional. */ public static Optional<ConnectionType> forName(final CharSequence name) { checkNotNull(name, "Name"); return Arrays.stream(values()) .filter(c -> c.name.contentEquals(name)) .findFirst(); }
/** * Returns the {@code ConnectionType} for the given {@code name} if it exists. * * @param name the name. * @return the ConnectionType or an empty optional. */ public static Optional<ConnectionType> forName(final CharSequence name) { checkNotNull(name, "Name"); return Arrays.stream(values()) .filter(c -> c.name.contentEquals(name)) .findFirst(); }