Logo

Programming-Idioms

History of Idiom 119 > diff from v2 to v3

Edit summary for version 3 by :
[Java] HashSet<> -> HashSet<T>

Version 2

2016-01-15, 10:11:56

Version 3

2016-01-15, 10:12:26

Idiom #119 Deduplicate list

Remove duplicates from list x.

Idiom #119 Deduplicate list

Remove duplicates from list x.

Imports
import java.util.HashSet;
import java.util.ArrayList;
Imports
import java.util.HashSet;
import java.util.ArrayList;
Code
x = new ArrayList<T>(new HashSet<>(x));
Code
x = new ArrayList<T>(new HashSet<T>(x));
Comments bubble
This creates a new ArrayList object.
Comments bubble
This creates a new ArrayList object.