public function merge( \PhpSets\Set $set ) {
        $iterator = $set->entries();

        // create a copy of $set
        $merged = new \PhpSets\Set();
        $merged->exchangeArray( $this->values() );

        // add values from $set if not present
        while ( $iterator->valid() ) {
            if ( ! $this->has( $iterator->current() ) ) {
                $merged->add( $iterator->current() );
            }
            $iterator->next();
        }

        $iterator->rewind();

        return $merged;
    }
public function merge( \PhpSets\Set $set ) {
        $iterator = $set->entries();

        // create a copy of $set
        $merged = new \PhpSets\Set();
        $merged->exchangeArray( $this->values() );

        // add values from $set if not present
        while ( $iterator->valid() ) {
            if ( ! $this->has( $iterator->current() ) ) {
                $merged->add( $iterator->current() );
            }
            $iterator->next();
        }

        $iterator->rewind();

        return $merged;
    }
public function merge ( \ PhpSets \ Set $ set ) { $ iterator = $ set -> entries ( ) ; // create a copy of $set $ merged = new \ PhpSets \ Set ( ) ; $ merged -> exchangeArray ( $ this -> values ( ) ) ; // add values from $set if not present while ( $ iterator -> valid ( ) ) { if ( ! $ this -> has ( $ iterator -> current ( ) ) ) { $ merged -> add ( $ iterator -> current ( ) ) ; } $ iterator -> next ( ) ; } $ iterator -> rewind ( ) ; return $ merged ; }
Returns a new Set which contains the unique items of the current and a given Set.

Elements from the merged set are appended to the current instance's values.

@param  \PhpSets\Set $set The set to append
@return \PhpSets\Set A new set containing the merged items
Returns a new Set which contains the unique items of the current and a given Set .