Hi !
It depends on what you is your ultimate goal:
- If you want just print names, use code proposed above by Jj:
- If you want to manipulate with distinct Winners later you need another approach because the map() operation will map from Winners to String and your Winners instances are lost.
In case you want to filter by distinct name and keep Winners in the stream, use a workaround described here (use distinctByKey custom predicate and filter stream by it):
https://stackoverflow.com/questions/23699371/java-8-distinct-by-property