Java Collection Unique unique(Collection c, Collection result)

Here you can find the source of unique(Collection c, Collection result)

Description

unique

License

Open Source License

Declaration

@SuppressWarnings("unchecked")
public static <T> Collection<T> unique(Collection<T> c, Collection<T> result) 

Method Source Code


//package com.java2s;
import java.util.*;

public class Main {

    @SuppressWarnings("unchecked")
    public static <T> Collection<T> unique(Collection<T> c, Collection<T> result) {
        if (c == null) {
            return result;
        }//from   w  w  w  .j  a  v  a  2 s  .com
        Set<T> s = new LinkedHashSet<T>(c);
        result.addAll(s);
        return result;
    }
}

Related

  1. getUniqueValue(Collection values, String initValue)
  2. hasUniqueObject(Collection collection)
  3. hasUniqueObject(Collection collection)
  4. hasUniqueObject(Collection collection)
  5. unique(Collection c)
  6. uniqueIdNotIn(String prefix, Collection exclusions)
  7. uniqueResult(Collection results)
  8. uniqueResult(final Collection c)