public ISet product(ISet other) { ShareableValuesHashSet newData = new ShareableValuesHashSet(); Type tupleType = typeFactory.tupleType(elementType, other.getElementType()); Iterator<IValue> thisIterator = data.iterator(); while (thisIterator.hasNext()) { IValue left = thisIterator.next(); Iterator<IValue> setIterator = other.iterator(); while (setIterator.hasNext()) { IValue right = setIterator.next(); IValue[] tuple = new IValue[] {left, right}; newData.add(Tuple.newTuple(tupleType, tuple)); } } return new SetWriter(tupleType, newData).done(); }
public Iterator<IValue> iterator() { return data.iterator(); }