/** * This method returns a hash set which represents the asymmetric difference between * the two specified hash sets. * * @access public * @static * @param IHashSet\Type $xs the first hash set * @param IHashSet\Type $ys the second hash set * @return IHashSet\Type a hash set which represents the (asymmetric) * difference of the two specified hash sets */ public static function without(IHashSet\Type $xs, IHashSet\Type $ys) : IHashSet\Type { $zs = IHashSet\Type::box($xs->unbox()); $yi = IHashSet\Module::iterator($ys); foreach ($yi as $y) { $zs->removeItem($y); } return $zs; }
/** * This constructor initializes this class with the specified collection. * * @access public * @final * @param IHashSet\Type $xs the collection to be iterated */ public final function __construct(IHashSet\Type $xs) { $this->iterator = new \RecursiveIteratorIterator(new IHashSet\RecursiveArrayOnlyIterator($xs->unbox())); $this->xs = $xs; $this->i = IInt32\Type::zero(); }