Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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().min(Comparator.reverseOrder());
        if (m.isPresent()) {
            System.out.println(m.get());
        } else {
            System.out.println("No Value");
        }

    }
}