Java tutorial
import java.util.Arrays; import java.util.List; public class Main { public static void main(String[] args) { List<String> names = Arrays.asList("HTML", "CSS", "CSS3", "Java", "SQL", "Javascript", "MySQL"); String name5 = names.stream().map(s -> s.toUpperCase()).filter(s -> s.length() < 5) .sorted((a, b) -> b.length() - a.length()).findFirst().orElse("a"); System.out.println(name5); String name2 = names.stream().map(s -> s.toUpperCase()).filter(s -> s.length() < 2) .sorted((a, b) -> b.length() - a.length()).findFirst().orElse("Somthing else"); System.out.println(name2); } }