Returns a list containing only unique values in a collection
545222
public static <T> List<T> getUnique(Collection<T> collection) {
        HashSet<T> set = new HashSet<>();
        List<T> out = new ArrayList<>();
        for (T t : collection) {
            if (!set.contains(t)) {
                out.add(t);
                set.add(t);
            }
        }
        return out;
    }
1124486
def unique_inverse(item_list):
    
    import utool as ut
    unique_items = ut.unique(item_list)
    inverse = list_alignment(unique_items, item_list)
    return unique_items, inverse
360025
public static <T> Collection<T> distinct(Collection<? extends T> collection) {
        return new HashSet<T>(collection);
    }
536332
public function unique() : Collection
    {
        $temp = $this->toArray();
        $rslt = [];
        foreach ($temp as $k => $v) {
            if (!in_array($v, $rslt, true)) {
                $rslt[$k] = $v;
            }
        }
        return new static($rslt);
    }
342537
function uniqueArray(arr) {
  var result = [];

  for (var i = 0; i < arr.length; i++) {
    if (result.indexOf(arr[i]) === -1) {
      result.push(arr[i]);
    }
  }

  return result;
}
368583
def unique(iterable):
    """"""
    seen = set()
    for item in iterable:
        if item not in seen:
            seen.add(item)
            yield item
1084737
@InternalFunction()
    public Boolean unique(final List<ProxyField> list)
    {
    	if (list == null)
    	{
    		return Boolean.TRUE;
    	}
        int size = list.size();
        int index = 0;
        for (ProxyField proxyField: list)
        {
            for (int i=index+1;i<size;i++)
            {
                if (list.get(i).getValue().equals(proxyField.getValue()))
                {
                    return Boolean.FALSE;
                }
            }
        }
        return Boolean.TRUE;
    }
950184
def unique(self, col_or_col_list):
        

        if isinstance(col_or_col_list, list):
            col_is_list = True
            col_list = col_or_col_list
        else:
            col_is_list = False
            col_list = [col_or_col_list]

        output = []

        for col in col_list:

            if self.auto_cache or self.cache_valid(col):
                # create factorization cache
                if not self.cache_valid(col):
                    self.cache_factor([col])

                # retrieve values from existing disk-based factorization
                col_values_rootdir = self[col].rootdir + '.values'
                carray_values = bcolz.carray(rootdir=col_values_rootdir, mode='r')
                values = list(carray_values)
            else:
                # factorize on-the-fly
                _, values = ctable_ext.factorize(self[col])
                values = values.values()

            output.append(values)

        if not col_is_list:
            output = output[0]

        return output
978933
def get_uniques(l):
    
    result = []

    for i in l:
        if i not in result:
            result.append(i)

    return result
874030
def unique_values(func):
    

    @wraps(func)
    def wrapper(*args, **kwargs):
        return unique_everseen(func(*args, **kwargs))

    return wrapper
725454
function unique(array) {
    array.sort();

    var i, item, lastItem;

    for (i = array.length - 1; i >= 0; i--) {
        item = array[i];
        if (item == lastItem) {
            array.splice(i, 1);
        } else {
            lastItem = item;
        }
    }

    return array;
}
830810
def unique_element(ll):
    
    seen = {}
    result = []
    for item in ll:
        if item in seen:
            continue
        seen[item] = 1
        result.append(item)
    return result
669116
public static int countUnique(Collection<?> collection) {
        HashSet<Object> set = new HashSet<>(collection);
        return set.size();
    }
1259126
function unique(arr) {
  var ret = [];

  for (var i = 0; i < arr.length; i++) {
    if (~ret.indexOf(arr[i])) continue;
    ret.push(arr[i]);
  }

  return ret;
}
1133819
def unique(lst):
    
    nl = []
    [(nl.append(e) if type(e) is not list else nl.extend(e)) \
     for e in lst if e not in nl]
    return nl
1341910
public static int[] Unique(int[] values) {
        HashSet<Integer> lst = new HashSet<Integer>();
        for (int i = 0; i < values.length; i++) {
            lst.add(values[i]);
        }

        int[] v = new int[lst.size()];
        Iterator<Integer> it = lst.iterator();
        for (int i = 0; i < v.length; i++) {
            v[i] = it.next();
        }

        return v;
    }
623084
def distinct(xs):
    """"""
    # don't use collections.OrderedDict because we do support Python 2.6
    seen = set()
    return [x for x in xs if x not in seen and not seen.add(x)]