src/precore/util/Iterators.php
public static function frequency(Iterator $iterator, $element) : int
    {
        $frequency = 0;
        Iterators::each($iterator, function ($item) use (&$frequency, $element) {
            if (Objects::equal($element, $item)) {
                $frequency++;
            }
        });
        return $frequency;
    }
public static function frequency(Iterator $iterator, $element) : int
    {
        $frequency = 0;
        Iterators::each($iterator, function ($item) use (&$frequency, $element) {
            if (Objects::equal($element, $item)) {
                $frequency++;
            }
        });
        return $frequency;
    }
Returns the number of elements in the specified iterator that equal the specified object.
The check based on {@link Objects::equal()}.

@param Iterator $iterator
@param $element
@return int