void (String[] args) { Wrapper<TaskId, DefaultEdge> w = new Wrapper<>(); Set<DefaultEdge> s = new HashSet<>(); s.add(new DefaultEdge(new TaskId("1"))); s.add(new DefaultEdge(new TaskId("2"))); s.add(new DefaultEdge(new TaskId("3"))); Set<TaskId> processed = s .stream() .map(w::unwrap) .filter(edge -> !edge.getId().equals("")) .collect(Collectors.toSet()); System.out.println(processed); }