void () { List<String> activities = Stream.of("12") .map(v -> v + "nya") .filter(v -> v != null) .flatMap(v -> Stream.of(v) .flatMap(s -> Stream.of(s)) ).filter(v -> { String name = v.getClass().getName(); if (name.equals("name")) { return false; } return !name.equals("other_name"); }) .collect(Collectors.toList()); }