However, you can do it O(n) time complexity by using a more efficient way to find the matching person frompeople1to remove. Map<String, Deque<Person>> map = people1.stream().collect(groupingBy(Person::getFirstName, toCollection(ArrayDeque::new)));for(Person p : peopl...