@param \Iterator $set

@return mixed
17598
public function apply(\Iterator $set)
    {
        $set->rewind();

        return $set->valid() ? $set->current() : $this->default;
    }
1076514
public static function instance( $set = null ) 
	{
		if ( is_null( $set ) ) 
		{
			return static::$_instance;
		}
		
		if ( !$set instanceof CCIn_Instance ) 
		{
			throw new \InvalidArgumentException('CCIn::set() - only CCIn_Instance object can be passed.');
		}
		
		static::$_instance = $set;
	}
601033
public static function groupBy($collection = null, $iterator = null)
    {
        $result = array();
        $collection = (array) $collection;
        foreach ($collection as $k => $item) {
            if (is_object($iterator) && is_callable($iterator)) {
                $key = $iterator($item, $k);
            } elseif (is_object($item)) {
                $key = $item->$iterator;
            } elseif (is_array($item)) {
                $key = $item[$iterator];
            }
            
            if (!array_key_exists($key, $result)) {
                $result[$key] = array();
            }
            $result[$key][$k] = $item;
        }
        return $result;
    }
304292
public static function fromASN1(Set $set): Attributes
    {
        $attribs = array_map(
            function (UnspecifiedType $el) {
                return Attribute::fromASN1($el->asSequence());
            }, $set->elements());
        // cast attributes
        $attribs = array_map(
            function (Attribute $attr) {
                $oid = $attr->oid();
                if (array_key_exists($oid, self::MAP_OID_TO_CLASS)) {
                    $cls = self::MAP_OID_TO_CLASS[$oid];
                    return $attr->castValues($cls);
                }
                return $attr;
            }, $attribs);
        return new self(...$attribs);
    }
1137016
public function get($setting)
    {
        return isset($this->settings[$setting]) ? $this->settings[$setting] : null;
    }
550897
public function update($set = array())
    {
        if (is_array($set)) {
            $params = array();
            foreach ($set as $field => $param) {
                $this->add('set', $field . ' = ?', true);
                $params[] = $param;
            }
            $this->params = array_merge($params, $this->params);
        } else {
            $this->add('set', $set, true);
        }
        $this->type = self::UPDATE;
        return $this->execute();
    }
571132
public static <T> Set<T> toSet(Iterable<T> iterable)
    {
        Objects.requireNonNull(iterable, "The iterable is null");
        return Iterables.toCollection(iterable, new LinkedHashSet<T>());
    }
912292
public function getDataset($key)
    {
        $data = $this->session->get(self::KEY);
        $set = isset($data[$key])
            ? $data[$key]
            : [];
        return $set;
    }
594152
public function apply(\Iterator $set)
    {
        $data = iterator_to_array($set);

        return implode($this->delimiter, $data);
    }
918614
public function intersect( \PhpSets\Set $set ) {
        $iterator = $set->entries();
        $intersect = new \PhpSets\Set;

        while ( $iterator->valid() ) {
            if ( $this->has( $iterator->current() ) ) {
                $intersect->add( $iterator->current() );
            }
            $iterator->next();
        }
        $iterator->rewind();

        return $intersect;
    }
669691
public function &__get($key)
    {
        $return = $this->get($key);

        if (\is_array($return)) {
            return static::create($return, $this->iteratorClass, false);
        }

        return $return;
    }
320613
public function lazySet(array $sets)
    {
        $config = $this->config();

        if (!array_key_exists('lazy-set', $config) || !is_array($config['lazy-set'])) {
            throw new \Exception('Config with key "lazy-set" does not exist or incorrect data type given in '.__NAMESPACE__);
        }
        $lazySetConfig = $config['lazy-set'];
        foreach ($sets as $set) {
            if (!array_key_exists($set, $lazySetConfig)) {
                throw new \Exception('"lazy-set" with name "'.$set.'" does not exist in '.__NAMESPACE__);
            }
        }
        $lazySets = array();
        foreach ($sets as $setIdentifier) {
            $lazySet = $lazySetConfig[$setIdentifier];
            foreach ($lazySet as $type => $set) {
                if (!is_array($set)) {
                    $lazySet[$type] = $set;
                    continue;
                }
                foreach ($set as $index => $attribute) {
                    $deepArray = !in_array($type, $this->deepArrayFalse);
                    $value = $this->configParser($type, $attribute);
                    if (empty($value)) {
                        $value = array();
                    }
                    if ($deepArray) {
                        $lazySet[$type][$index] = $value;
                    } else {
                        $lazySet[$type] = $value;
                    }
                }
            }
            $lazySets = array_merge_recursive($lazySet, $lazySets);
        }
        return $lazySets;
    }
1040598
public function subset( \PhpSets\Set $set ) {
        $iterator = $set->entries();

        // iterate through $set and return false is an uncommon value is present
        while ( $iterator->valid() ) {
            if ( ! $this->has( $iterator->current() ) ) {
                return false;
            }
            $iterator->next();
        }

        $iterator->rewind();

        return true;
    }
338995
protected function getSetter($key)
    {
        $key = str_replace('_', ' ', $key);
        $key = ucwords($key);
        $key = str_replace(' ', '', $key);

        return 'set'.$key;
    }
1302005
public function hmget($key) {

        $set     = $this->getKey($collection, $key, []);
        $fields  = func_get_args();
        $values  = [];

        for ($i=1; $i<count($fields); $i++){
            $field = $fields[$i];
            $values[] = isset($set[$field]) ? $set[$field]:null;
        }

        return $values;
    }
1274251
public function map(array $collection, Closure $iterator)
    {
        foreach ($collection as $key => $node)
        {
            $collection[$key] = $iterator($key, $node);
        }

        return $collection;
    }
87924
public function position( $set = null )
    {
        static $validPositions = array(
            self::POSITION_LEFT,
            self::POSITION_RIGHT
        );

        if ( null !== $set )
        {
            $set = strtolower( $set );

            if ( ! in_array( $set, $validPositions ) )
            {
                $set = static::POSITION_LEFT;
            }
        }

        return $this->setting( 'position', $set );
    }