@Test public void generateAllSubsetsOfANonEmptySet() { PowerSet powerSet = new PowerSet(new HashSet<String>(Arrays.asList(inputSet))); Iterator<Set<String>> subsetIter = powerSet.iterator(); while (subsetIter.hasNext()) { Set<String> currentSubset = subsetIter.next(); assertTrue(expectedPowerSet.contains(currentSubset)); subsetIter.remove(); expectedPowerSet.remove(currentSubset); } }
@Override public Iterator<Set<String>> iterator() { return powerSet.iterator(); }
PowerSet implements Iterable<Set<String>> { @Override public Iterator<Set<String>> iterator() { return powerSet.iterator(); } }
PowerSet implements Iterable<Set<String>> { @Override public Iterator<Set<String>> iterator() { return powerSet.iterator(); } PowerSet(Set<String> inputSet); }
PowerSet implements Iterable<Set<String>> { @Override public Iterator<Set<String>> iterator() { return powerSet.iterator(); } PowerSet(Set<String> inputSet); @Override Iterator<Set<String>> iterator(); Set<Set<String>> subsets(); }
PowerSet implements Iterable<Set<String>> { @Override public Iterator<Set<String>> iterator() { return powerSet.iterator(); } PowerSet(Set<String> inputSet); @Override Iterator<Set<String>> iterator(); Set<Set<String>> subsets();  }