1 2 3 4 5
OptionalInt stream = IntStream.range(0, options.length) .filter(i -> Objects.equals(options[i], args[0])) .findFirst(); int option = stream.isPresent() ? stream.getAsInt() : -1;