Compares the collection against $items and returns the keys that exist in the collection.

@performanceCompared true
541454
public function intersectKeys(iterable $items): self
    {
        $items = Factory::getArrayForItems($items);

        return Factory::create(array_intersect_key($this->items, $items));
    }
881842
public function even(): ArrayCollection
    {
        $items = [];
        $pos = 0;

        foreach ($this->items as $key => $value) {
            if ($pos % 2 === 0) {
                $items[$key] = $value;
            }
            $pos++;
        }

        return new static($items);
    }
478163
public function where($items, array $keyValuePairs, $comparator = 'eq', $booleanOperator = 'and')
    {
        if (is_array($items)) {
            $items = new ArrayCollection($items);
        }
        if ($items instanceof PersistentCollection && !$items->isInitialized()) {
            $items->initialize();
        }

        $whereMethod = $booleanOperator . 'Where';

        $eb = new ExpressionBuilder();
        $criteria = new Criteria();
        foreach ($keyValuePairs as $key => $value) {
            if (is_array($value)) {
                if ($comparator === 'eq') {
                    $criteria->$whereMethod($eb->in($key, $value));
                    continue;
                } elseif ($comparator === 'neq') {
                    $criteria->$whereMethod($eb->notIn($key, $value));
                    continue;
                }
            }
            $criteria->$whereMethod($eb->$comparator($key, $value));
        }

        return $items->matching($criteria);
    }
58444
public function keysExist(array $keys)
    {
        foreach ($keys as $key) {
            if (!$this->keyExists($key)) {
                return false;
            }
        }
        return true;
    }
269729
public static <T extends Comparable<T>> int compare(Collection<T> collection1, Collection<T> collection2, ComparisonStyle style) {
        if (style != ComparisonStyle.LEXICOGRAPHIC) {
            int diff = collection1.size() - collection2.size();
            if (diff != 0) {
                return (diff < 0) == (style == ComparisonStyle.SHORTER_FIRST) ? -1 : 1;
            }
        }
        return compare(collection1, collection2);
    }
76127
public static function collect($items, $key)
    {
        $array = array();

        foreach ($items as $v) {
            if (is_array($key)) {
                foreach ($key as $index => $k) {
                    if (!isset($array[$k])) {
                        $array[$k] = array();
                    }
                    $array[$k][] = self::getValue($v, $k);
                }
            } else {
                $array[] = self::getValue($v, $key);
            }
        }

        return $array;
    }
43032
protected function getValues($item, array $keys)
    {
        $values = [];
        foreach ($keys as $key) {
            $values[] = Vale::get($item, $key);
        }

        return $values;
    }
1222616
public function containsKey($key): bool
    {
        return isset($this->items[$key]) || array_key_exists($key, $this->items);
    }
585933
protected function sort(array $items) : array
    {
        if (count($items) > 1)
        {
            usort($items, function(&$a, &$b)
            {
                $getterName = $this->getterName;

                $compare = mb_strtolower($a['item']->$getterName()) > mb_strtolower($b['item']->$getterName());

                if ($this->criteria === Criteria::ASC)
                {
                    return $compare;
                }

                return !$compare;
            });
        }

        return $items;
    }
172618
protected function getItems($items)
    {
        if (\is_array($items)) {
            return $items;
        } elseif ($items instanceof self) {
            return $items->all();
        } elseif ($items instanceof Traversable) {
            return \iterator_to_array($items);
        }
        return (array) $items;
    }
1166186
public function getVisits($items)
  {
    $result = [];
    foreach ($items as $item) {
      $result[] = new Visit($item);
    }

    return $result;
  }
162179
public function has($key): bool
    {
        return isset($this->items[$key]) || array_key_exists($key, $this->items);
    }
108303
public function hasItem($key)
    {
        if (!$this->getOptions()->getEnabled()) {
            return false;
        }

        $this->normalizeKey($key);

        $result = false;
        try {
            $result = $this->internalHasItem($key);
        } catch (\Exception $e) {
        }

        return $result;
    }
757110
protected function getArrayableItems($items)
		{
			if ($items instanceof self) {
				$items = $items->all();
			} elseif ($items instanceof Arrayable) {
				$items = $items->toArray();
			}

			return $items;
		}
447915
public function process(array $items)
    {
        foreach ($items as $key => $item) {
            $items[$key] = $this->setImages($item);
        }

        return $items;
    }
865755
public boolean containsKeys(Collection<K> keys) {
        for(K key: keys)
            if(!map.containsKey(key))
                return false;
        return true;
    }
1131424
public function compare( $item1, $item2 ) {

			return $this->comparer === null
				? self::defaultCompareWrapper( $item1, $item2 )
				: $this->comparer( $item1, $item2 );

		}