Class UnmodifiableMapKeySizedIterator<K>

  • Type Parameters:
    K - is the type of keys.
    All Implemented Interfaces:
    Iterator<K>, SizedIterator<K>

    public class UnmodifiableMapKeySizedIterator<K>
    extends Object
    implements SizedIterator<K>
    Class that map the keys of a Map to an unmodifiable sized iterator.

    A sized iterator is an Iterator that is able to reply the size of the iterated collection and the number of elements that may be encountered in the next iterations.

    This class provides features closed to Collections.unmodifiableMap(Map) but with a sized iterators on the keys of the map. To obtain similar features on the map values, see UnmodifiableMapValueSizedIterator.

    This iterator disables the use of the function Iterator.remove().

    Version:
    17.0 2020-01-04 14:41:38
    Author:
    Stéphane GALLAND
    See Also:
    UnmodifiableMapValueSizedIterator
    Maven Group Id:
    org.arakhne.afc.core
    Maven Artifact Id:
    util
    • Constructor Detail

      • UnmodifiableMapKeySizedIterator

        public UnmodifiableMapKeySizedIterator​(Map<K,​?> map)
        Construct an iterator.
        Parameters:
        map - the map to iterate on.
    • Method Detail

      • rest

        @Pure
        public int rest()
        Description copied from interface: SizedIterator
        Replies the count of elements which are not replied by the iterator.
        Specified by:
        rest in interface SizedIterator<K>
        Returns:
        the count of elements which are not replied by the iterator.
      • index

        @Pure
        public int index()
        Description copied from interface: SizedIterator
        Replies the position of the last replied element in the iterated collection.
        Specified by:
        index in interface SizedIterator<K>
        Returns:
        the index of the last element replied by next().
      • totalSize

        @Pure
        public int totalSize()
        Description copied from interface: SizedIterator
        Replies the count of elements in the iterated collection.
        Specified by:
        totalSize in interface SizedIterator<K>
        Returns:
        the count of elements in the iterated collection.
      • hasNext

        @Pure
        public boolean hasNext()
        Specified by:
        hasNext in interface Iterator<K>
      • next

        public K next()
        Specified by:
        next in interface Iterator<K>