Assuming I have some collection, how could I quickly return only those values that appear exactly once? I don’t want to reduce duplicate values down to a single entry, I want to eliminate them completely – these are non-valid for my use case. As an example, a list containing 1, 2, 3, 1, 4, 3, 5, 1
should only return 2, 4, 5
. I could loop over the list, count the elements and then remove all that appear more than once, but I’m wondering if there’s a more elegant .stream()-solution I’m missing.