function partition(callable $closure) {
        $collection1 = new self();
        $collection2 = new self();
        
        foreach($this->data as $key => $val) {
            if($closure($val, $key)) {
                $collection1->set($key, $val);
            } else {
                $collection2->set($key, $val);
            }
        }
        
        return array($collection1, $collection2);
    }
function partition(callable $closure) {
        $collection1 = new self();
        $collection2 = new self();
        
        foreach($this->data as $key => $val) {
            if($closure($val, $key)) {
                $collection1->set($key, $val);
            } else {
                $collection2->set($key, $val);
            }
        }
        
        return array($collection1, $collection2);
    }
function partition ( callable $ closure ) { $ collection1 = new self ( ) ; $ collection2 = new self ( ) ; foreach ( $ this -> data as $ key => $ val ) { if ( $ closure ( $ val , $ key ) ) { $ collection1 -> set ( $ key , $ val ) ; } else { $ collection2 -> set ( $ key , $ val ) ; } } return array ( $ collection1 , $ collection2 ) ; }
Partitions the collection into two collections where the first collection contains the items that passed and the second contains the items that failed.
@param callable  $closure  Callback specification: `function ($value, $key): bool`
@return \CharlotteDunois\Collect\Collection[]
Partitions the collection into two collections where the first collection contains the items that passed and the second contains the items that failed .