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;
    }
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;
    }
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 ; }
Returns a new Set object containing the common elements between two given sets

@param  \PhpSets\Set $set
@return \PhpSets\Set
Returns a new Set object containing the common elements between two given sets