Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.Comparator;
import java.util.List;
import java.util.Optional;

public class Main {
    public static void main(String... args) {
        List<String> names3 = null;

        Optional.ofNullable(names3).ifPresent(list -> list.sort(Comparator.naturalOrder()));

        System.out.println(names3);

    }
}