Class SubsetConfiguration.SubsetIterator

java.lang.Object
org.apache.commons.configuration2.SubsetConfiguration.SubsetIterator
All Implemented Interfaces:
Iterator<String>
Enclosing class:
SubsetConfiguration

private final class SubsetConfiguration.SubsetIterator extends Object implements Iterator<String>
A specialized iterator to be returned by the getKeys() methods. This implementation wraps an iterator from the parent configuration. The keys returned by this iterator are correspondingly transformed.
  • Field Details

    • parentIterator

      private final Iterator<String> parentIterator
      Stores the wrapped iterator.
  • Constructor Details

    • SubsetIterator

      public SubsetIterator(Iterator<String> it)
      Creates a new instance of SubsetIterator and initializes it with the parent iterator.
      Parameters:
      it - the iterator of the parent configuration
  • Method Details

    • hasNext

      public boolean hasNext()
      Checks whether there are more elements. Delegates to the parent iterator.
      Specified by:
      hasNext in interface Iterator<String>
      Returns:
      a flag whether there are more elements
    • next

      public String next()
      Returns the next element in the iteration. This is the next key from the parent configuration, transformed to correspond to the point of view of this subset configuration.
      Specified by:
      next in interface Iterator<String>
      Returns:
      the next element
    • remove

      public void remove()
      Removes the current element from the iteration. Delegates to the parent iterator.
      Specified by:
      remove in interface Iterator<String>