@Override public boolean subset(Set<E> S) { if (setList.isEmpty()) { return true; } do { if (!S.setList.find(setList.retrieve())) { return false; } } while (setList.goToNext()); return true; }
@Override public Set<E> intersection(Set<E> S) { Set<E> intersection = new Set<E>(); if (!setList.goToFirst()) return intersection; if (S.setList.isEmpty()) return intersection; do { E el = setList.retrieve(); if (S.setList.find(el)) { intersection.addElement(el); } } while (setList.goToNext()); return intersection; }
@Override public Set<E> difference(Set<E> S) { if (!setList.goToFirst()) return this; if (S.isEmpty()) return this; Set<E> difference = new Set<E>(); do { E el = setList.retrieve(); if (!S.setList.find(el)) { difference.addElement(el); } } while (setList.goToNext()); return difference; }
@Override public Table<K, V> clone() { Table copy; try { copy = (Table) super.clone(); } catch (CloneNotSupportedException e) { throw new Error(""); } copy.table = new List<Mapping>(); Mapping map; for (int i = 0; i < this.size(); i++) { map = table.retrieve(); copy.addEntry(map.key, map.value); table.goToNext(); } return copy; }