Check whether any values in $collection pass $iterator.

@param array $collection
@param Closure $iterator
@return boolean
778073
public function any(array $collection, Closure $iterator)
    {
        foreach ($collection as $node)
        {
            if ($iterator($node))
            {
                return true;
            }
        }

        return false;
    }
183129
public function validate(Collection $collection = null)
    {
        $this->errors = [];
        foreach ($this->getValuesAsArray() as $index => $value) {
            # skip fields with a null value if they are not required
            if ($value === null && $this->hasRule(Rule::REQUIRED) === false) {
                continue;
            }

            foreach ($this->rules as $name => $rule) {
                $rule->setValue($value);
                $rule->setField($this, $index);
                $rule->setCollection($collection);
                if ($rule->validate() === true) {
                    $fmtValue = $rule->getValue();
                    if ($fmtValue !== $value) {
                        $value = $fmtValue;
                        $this->setValue($fmtValue, $index);
                    }
                }
                else {
                    $this->errors[] = $rule->getError();
                    break;
                }
            }
        }
        return count($this->errors) === 0;
    }
25404
public function _validation_match_collection($val, $collection = array())
	{
		if ( ! is_array($collection))
		{
			$collection = func_get_args();
			array_shift($collection);
		}

		return in_array($val, $collection);
	}
889162
public function hasCollection($collection)
    {
        if (empty($this->queriesResultCache[ 'collectionNames' ])) {
            $this->getCollections();
        }

        return (bool)in_array($collection, $this->queriesResultCache[ 'collectionNames' ]);
    }
24615
function each(collection, fn, scope) {
  var i = 0,
    cont;

  for (i; i < collection.length; i++) {
    cont = fn.call(scope, collection[i], i);
    if (cont === false) {
      break; //allow early exit
    }
  }
}
1051145
public function reject(\Closure $closure): self
    {
        // init
        $filtered = [];

        foreach ($this->getGenerator() as $key => $value) {
            if (!$closure($value, $key)) {
                $filtered[$key] = $value;
            }
        }

        return static::create(
            $filtered,
            $this->iteratorClass,
            false
        );
    }
256986
function (collection) {
    if (!collection || !_.isObject(collection)) {
      var err = new Error('Please pass a valid collection!');
      debug(err);
      throw err;
    }

    this.collection = collection;
  }
641906
protected function is_collection_like($value)
    {
        if ($value instanceof self) {
            return true;

        } else if ($value instanceof \Traversable) {
            return true;

        } else if ($value instanceof Arrayable) {
            return true;

        } else if ($value instanceof Jsonable) {
            return true;

        } else if (is_object($value) || is_array($value)) {
            return true;

        } else {
            return false;
        }
    }
187878
function each(source, iterator) {
        if (source instanceof Array) {
            for (var i = 0, len = source.length; i < len; i++) {
                if (iterator(source[i], i) === false) {
                    break;
                }
            }
        }
    }
445804
private function isResourceName(\ArrayIterator $iterator): bool
    {
        return !(
            $this->isTTL($iterator) ||
            Classes::isValid(strtoupper($iterator->current())) ||
            RDataTypes::isValid(strtoupper($iterator->current()))
        );
    }
559169
private Iterator getValuesIterator(Object value) {

        if (value instanceof Collection) {
            return ((Collection) value).iterator();
        } else {
            return (new ArrayIterator(value));
        }

    }
1067237
public function intersects(Collection $list) : bool
    {
        $intersect = [];
        $main = $this->getSize();
        $oth = $list->getSize();

        if ($main > $oth) {
            foreach ($list->getList() as $item) {
                $intersect[] = in_array($item, $this->toArray());
            }
        } elseif ($oth > $main) {
            foreach ($this->getList() as $item) {
                $intersect[] = in_array($item, $list->toArray());
            }
        }

        return in_array(true, $intersect);
    }
601033
public static function groupBy($collection = null, $iterator = null)
    {
        $result = array();
        $collection = (array) $collection;
        foreach ($collection as $k => $item) {
            if (is_object($iterator) && is_callable($iterator)) {
                $key = $iterator($item, $k);
            } elseif (is_object($item)) {
                $key = $item->$iterator;
            } elseif (is_array($item)) {
                $key = $item[$iterator];
            }
            
            if (!array_key_exists($key, $result)) {
                $result[$key] = array();
            }
            $result[$key][$k] = $item;
        }
        return $result;
    }
1274251
public function map(array $collection, Closure $iterator)
    {
        foreach ($collection as $key => $node)
        {
            $collection[$key] = $iterator($key, $node);
        }

        return $collection;
    }
1111213
function each( source, iterator ) {
        if ( isArray( source ) ) {
            for ( var i = 0, len = source.length; i < len; i++ ) {
                if ( iterator( source[ i ], i ) === false ) {
                    break;
                }
            }
        }
    }
245873
public function thru(callable $iterator) : Collection
    {
        $temp = $this->toArray();
        $rslt = call_user_func($iterator, $temp);
        return new static($rslt);
    }
1362986
public function groupBy($collection=null, $iterator=null) {
    list($collection, $iterator) = self::_wrapArgs(func_get_args(), 2);
    
    $result = array();
    $collection = (array) $collection;
    foreach($collection as $k=>$v) {
      $key = (is_callable($iterator)) ? $iterator($v, $k) : $v[$iterator];
      if(!array_key_exists($key, $result)) $result[$key] = array();
      $result[$key][] = $v;
    }
    return $result;
  }