コード例 #1
0
ファイル: SortedList.php プロジェクト: malarzm/collections
 /**
  * Initializes SortedList ensuring that elements are in fact a sorted list.
  *
  * @param array $elements
  * @param boolean $sortElements If true, elements will be sorted when creating the list
  */
 public function __construct(array $elements = [], $sortElements = true)
 {
     parent::__construct($elements);
     if ($sortElements) {
         usort($this->elements, [$this, 'compare']);
     }
 }