Java tutorial
import java.util.Arrays; import java.util.List; import java.util.Optional; public class Main { public static void main(String[] args) { List<String> names = Arrays.asList("XML", "HTML", "Java", "Javascript", "CSS", "Static"); Optional<String> firstZ = names.stream().filter(name -> name.startsWith("Z")).findFirst(); if (firstZ.isPresent()) { System.out.println(firstZ.get()); } else { System.out.println("No Z's found"); } } }