unique method

@method unique
451
public function unique() : Collection
    {
        $acc = [];
        foreach ($this->list as $item) {
            if (!in_array($item, $acc)) {
                $acc[] = $item;
            }
        }

        return self::from(...$acc);
    }
769279
def uniq(&block)
      if block
        new(attributes.uniq(&block))
      else
        new(attributes.uniq(&:name))
      end
    end
65570
function unique(array) {
  const results = [];

  for (let idx = 0, len = array.length; idx < len; idx++) {
    if (!contains(results, array[idx])) {
      results.push(array[idx]);
    }
  }

  return results;
}
1071530
public function uniqueKeepIndex(): self
    {
        // INFO: \array_unique() can't handle e.g. "stdClass"-values in an array

        // init
        $array = $this->getArray();

        $this->array = \array_reduce(
            \array_keys($array),
            static function ($resultArray, $key) use ($array) {
                if (!\in_array($array[$key], $resultArray, true)) {
                    $resultArray[$key] = $array[$key];
                }

                return $resultArray;
            },
            []
        );
        $this->generator = null;

        if ($this->array === null) {
            $this->array = [];
        } else {
            $this->array = (array) $this->array;
        }

        return $this;
    }
1329118
public UniqueModel unique(String uniqueName) {
		checkReadOnly();
		UniqueModel unique = new UniqueModel();
		unique.setName(uniqueName);
		unique.setTableModel(this);
		getUniqueConsts().add(unique);
		return unique;
	}
13972
public function unique($columns, $name = null, $algorithm = null)
    {
        return $this->indexCommand('unique', $columns, $name, $algorithm);
    }
338371
function validateUniqueness(attr, conf, err, done) {
    var cond = {where: {}};
    cond.where[attr] = this[attr];
    this.constructor.all(cond, function (error, found) {
        if (found.length > 1) {
            err();
        } else if (found.length === 1 && (!this.id || !found[0].id || found[0].id.toString() !== this.id.toString())) {
            err();
        }
        done();
    }.bind(this));
}
1052838
function distinct(array){
  return Object.keys(array.reduce(function(current, value){
    current[value] = true;
    return current;
  }, {}));
}
585512
public function setUnique($unique)
    {
        if (!is_bool($unique)) {
            throw new \InvalidArgumentException('The attribute unique on the class Attribute has to be boolean (' . gettype($unique) . ('object' === gettype($unique) ? ' ' . get_class($unique) : '') . ' given).');
        }

        $this->unique = $unique;

        return $this;
    }
938526
function uniqueize(a) {
  return a.filter((elt, i) => a.indexOf(elt) === i);
}
220381
function unique(arr) {
    return arr.filter(function (value, idx, self) {
        return self.indexOf(value) === idx;
    });
}
265424
function unique(oldArray) {
    var nIndex,
      nLen = oldArray.length,
      aArr = [];
    for (nIndex = 0; nIndex < nLen; nIndex++) {
      if (!contains(aArr, oldArray[nIndex][1])) {
        aArr.push(oldArray[nIndex]);
      }
    }
    return aArr;
  }
1100349
def method_missing(name, *arguments)
      self.class.marked_unique.add(self)

      @max_retries.times do
        result = @generator.public_send(name, *arguments)

        next if @previous_results[[name, arguments]].include?(result)

        @previous_results[[name, arguments]] << result
        return result
      end

      raise RetryLimitExceeded, "Retry limit exceeded for #{name}"
    end
146336
function unique(acls) {
    var newAcls = [];
    // Remove empty and duplicate ACLs from specified list
    acls.forEach(function(acl) {
      if (!acl.isEmpty()) {
        var found = false;
        var len = newAcls.length;
        for (var i = 0; !found && i < len; i++)
          found = newAcls[i].equals(acl);
        if (!found)
          newAcls.push(acl);
      }
    });
    return newAcls;
  }
32075
public function unique(): self
    {
        // INFO: \array_unique() can't handle e.g. "stdClass"-values in an array

        $this->array = $this->reduce(
            static function ($resultArray, $value) {
                if (!\in_array($value, $resultArray, true)) {
                    $resultArray[] = $value;
                }

                return $resultArray;
            },
            []
        )->getArray();
        $this->generator = null;

        return $this;
    }
290152
def _unique(session, cls, queryfunc, constructor, arg, kw):
    '''
    
    '''
    with session.no_autoflush:
        q = session.query(cls)
        q = queryfunc(q, *arg, **kw)
        obj = q.first()
        if not obj:
            obj = constructor(*arg, **kw)
            session.add(obj)
    return obj
1197898
function recordUnique(name, uniqueId, statistics, aggregations, timestamp, callback) {
        timestamp = timestamp || Date.now();
        // normal record
        if(statistics) {
            var num = Array.isArray(uniqueId) ? uniqueId.length : 1;
            record(name, num, statistics, aggregations, timestamp);
        }
        // record unique
        var multi = redis.multi();
        granularities.forEach(function(gran) {
                var key = getGranKey(name, gran, timestamp);
                var expireTime = util.getExpireTime(gran, timestamp);
                var pfkey = key + ':pf';
                multi.hset(keyPFKeys, pfkey, expireTime);
                if(Array.isArray(uniqueId)) {
                    multi.pfadd.apply(multi, [pfkey].concat(uniqueId));
                } else {
                    multi.pfadd(pfkey, uniqueId);
                }
                // recordStats(key);
                var unitPeriod = gran[0];
                multi.hincrby(key, 'uni', 0);
                multi.expire(key, points * unitPeriod / 1000);
        });
        multi.exec(callback || log);
    }