Optional<String> (List<Object> list) { Optional<Object> first = list.stream().filter(obj -> obj instanceof String).findFirst(); return !fi<caret>rst.isPresent() ? Optional.empty() : Optional.of((String) first.get()); }