void (String[] args) { Stream<String> tokenStream = Stream.of("hello", "world"); Comparator<String> order = Comparator.naturalOrder(); Min<String> min = tokenStream.collect( () -> new Min<>(order), Min::accept, Min::combine); System.out.printf("Min = %s%n", min.asOptional().orElse(null)); }