Class SubsetIterator<T>

  • Type Parameters:
    T - The elements of the set
    All Implemented Interfaces:
    java.util.Iterator<java.util.Set<T>>
    Direct Known Subclasses:
    DefaultSubsetIterator, IncreasingSubsetIterator, RandomSubsetIterator

    public abstract class SubsetIterator<T>
    extends java.lang.Object
    implements java.util.Iterator<java.util.Set<T>>
    Iterates over all subsets of a given set.
    Author:
    Matthias Thimm
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Set<T> set
      The set this iterator is iterating over.
    • Constructor Summary

      Constructors 
      Constructor Description
      SubsetIterator​(java.util.Set<T> set)
      Creates a new subset iterator for the given set.
    • Method Summary

      Modifier and Type Method Description
      protected java.util.Set<T> getSet()
      Returns the set this iterator is iterating over.
      abstract boolean hasNext()  
      abstract java.util.Set<T> next()  
      void remove()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Iterator

        forEachRemaining
    • Field Detail

      • set

        private java.util.Set<T> set
        The set this iterator is iterating over.
    • Constructor Detail

      • SubsetIterator

        public SubsetIterator​(java.util.Set<T> set)
        Creates a new subset iterator for the given set.
        Parameters:
        set - some set.
    • Method Detail

      • getSet

        protected java.util.Set<T> getSet()
        Returns the set this iterator is iterating over.
        Returns:
        The set this iterator is iterating over.
      • remove

        public void remove()
        Specified by:
        remove in interface java.util.Iterator<T>
      • hasNext

        public abstract boolean hasNext()
        Specified by:
        hasNext in interface java.util.Iterator<T>
      • next

        public abstract java.util.Set<T> next()
        Specified by:
        next in interface java.util.Iterator<T>