reduce duplication in collection code example
Example 1: laravel collection remove duplicates
$unique = $collection->unique();
Example 2: java remove equal element of a list
public static <T> List<T> removeDuplicates(List<T> list){
Set<T> set = new LinkedHashSet<>(list);
return new ArrayList<T>(set);
}