Partition the Collection into two Collections using the given callback or key.

Based on Laravel: Illuminate\Support\Collection.partition

@param callable|string $callback

@return static[static, static]
963703
public function partition($callback)
    {
        $partitions = [new static, new static];
        $callback   = $this->valueAccessor($callback);

        foreach ($this->items as $key => $item) {
            $partitions[(int) ! $callback($item)][$key] = $item;
        }

        return new static($partitions);
    }
54120
public function map(callable $callback): Sequence
    {
        $items = $this->items->map($callback);

        return $this->duplicate($items);
    }
155064
public function sort($callback)
    {
        $newCollection = clone $this;
        \uasort($newCollection->arrCollection, $callback);

        $newCollection->arrCollection = \array_values($newCollection->arrCollection);

        return $newCollection;
    }
514679
public function each($callback)
    {
        foreach ($this->_data as $key => $val) {
            $this->_data[$key] = $callback($val, $key, $this);
        }
        return $this;
    }
1130100
public function filter(\Closure $callback = null) : Collection
    {
        if ($callback) {
            return static::create(array_filter($this->data, $callback));
        }

        return static::create(array_filter($this->data));
    }
792991
public function mapToGroups(callable $callback)
    {
        $groups = $this->map($callback)->reduce(function ($groups, $pair) {
            $groups[key($pair)][] = reset($pair);

            return $groups;
        }, []);

        return (new static($groups))->map([$this, 'make']);
    }
1144027
public function filter($callback = null)
    {
        if (is_null($callback)) {
            return new static(array_filter($this->array)); 
        }
        return new static(array_filter($this->array, $callback));
    }
62101
public function filter(callable $callback = null)
    {
        if ($callback) {

            return new static(ArrayHelper::where($this->items, $callback));
        }

        return new static(array_filter($this->items));
    }
1066566
public function map($callback) : ArrayList
    {
        $values = $this->_map($callback);
        $this->setValues($values);
        return $this;
    }
525147
public function map($callback)
    {
        $values = $this->_map($callback);
        $this->setValues($values);
        return new Collection($values);
    }
627475
public function map($callback)
    {
        if (!is_callable($callback)) {
            throw new \InvalidArgumentException('Mapping function is not callable!');
        }

        $this->attributes = array_map($callback, $this->attributes);

        return $this;
    }
1099781
public function previousUntil(callable $callback, $inclusive = FALSE) {
    $matches = [];
    foreach ($this->nodes as $node) {
      $matches = array_merge($matches, $node->previousUntil($callback, $inclusive)->nodes);
    }
    return new NodeCollection($matches);
  }
1235819
public function each($callback)  
    {
        Eden_Array_Argument::i()->test(1, 'callable');

        foreach ($this->data as $key => $value) {
            call_user_func($callback, $key, $value);
        }

        return $this;
    }
818102
public function filter(\Closure $callback)
    {
        $results = array_filter($this->all(), $callback, ARRAY_FILTER_USE_BOTH);

        return new static($results);
    }
463483
public function find(callable $callback) {
    $matches = [];
    foreach ($this->nodes as $node) {
      if ($node instanceof ParentNode) {
        $matches = array_merge($matches, $node->find($callback)->nodes);
      }
    }
    return new NodeCollection($matches);
  }
699329
public function some(callable $callback) {
		$match = false;
		foreach ($this->collection as $element) {
			$match = $match || $callback($element);
		}

		return $match;
	}
178117
public function filter(callable $callback = null): CollectionInterface
    {
        if (!$callback) {
            $callback = function ($item) {
                return (bool)$item;
            };
        }

        return $this->wrap(function (Iterator $data) use ($callback) {
            foreach ($data as $key => $item) {
                if ($callback($item, $key)) {
                    yield $key => $item;
                }
            }
        });
    }