Java tutorial
import java.util.Arrays; import java.util.Comparator; import java.util.List; import java.util.Optional; public class Main { public static void main(String[] args) { List<String> stringList = Arrays.asList("2", "1", "3", "4"); Optional<String> m = stringList.stream().max(Comparator.reverseOrder()); if (m.isPresent()) { System.out.println(m.get()); } else { System.out.println("No Value"); } } }