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;
    }