|
|
@ -7,6 +7,9 @@ use Closure;
|
|
|
|
use Countable;
|
|
|
|
use Countable;
|
|
|
|
use IteratorAggregate;
|
|
|
|
use IteratorAggregate;
|
|
|
|
use JsonSerializable;
|
|
|
|
use JsonSerializable;
|
|
|
|
|
|
|
|
use SGH\Comparable\Comparable;
|
|
|
|
|
|
|
|
use SGH\Comparable\Comparator;
|
|
|
|
|
|
|
|
use Throwable;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Interface for an immutable (read-only) collection
|
|
|
|
* Interface for an immutable (read-only) collection
|
|
|
@ -125,6 +128,34 @@ interface IImmutableCollection extends IteratorAggregate, JsonSerializable, Coun
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function map (Closure $process): self;
|
|
|
|
public function map (Closure $process): self;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Sort the elements (by value)
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param null|Comparator|Closure(TValue, TValue):int $sorter The sorting method ; Null if values are object implementing {@see Comparable}.
|
|
|
|
|
|
|
|
* <br>Return :
|
|
|
|
|
|
|
|
* <br>< 0 if value1 is before value2
|
|
|
|
|
|
|
|
* <br>= 0 if value1 equals value2
|
|
|
|
|
|
|
|
* <br>> 0 if value1 is after value2
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @return self The sorted collection
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @throws Throwable If an error occurs
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public function sort (Closure|Comparator|null $sorter = null): self;
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Sort the elements by key
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param Comparator|Closure(TKey, TKey):int $sorter The sorting method. Return :
|
|
|
|
|
|
|
|
* <br>< 0 if key1 is before key2
|
|
|
|
|
|
|
|
* <br>= 0 if key1 equals key2
|
|
|
|
|
|
|
|
* <br>> 0 if key1 is after key2
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @return self The sorted collection
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @throws Throwable If an error occurs
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public function sortByKey (Closure|Comparator $sorter): self;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* The list of all keys
|
|
|
|
* The list of all keys
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -163,7 +194,7 @@ interface IImmutableCollection extends IteratorAggregate, JsonSerializable, Coun
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param IImmutableCollection ...$collections The other collections to combine
|
|
|
|
* @param IImmutableCollection ...$collections The other collections to combine
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @return static The combine collection
|
|
|
|
* @return static The combined collection
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function combineWith (IImmutableCollection ...$collections): self;
|
|
|
|
public function combineWith (IImmutableCollection ...$collections): self;
|
|
|
|
}
|
|
|
|
}
|