Class FastIteratingContainer

  • All Implemented Interfaces:
    java.util.Map<java.lang.Object,​java.lang.Object>, Container

    public final class FastIteratingContainer
    extends java.lang.Object
    implements Container
    The FastIteratingContainer implementation of the Container interface assuems two things:
    • Puts and removes are rare in proportion to gets and iteration are common. Put and remove are much more expensive here than in MapContainer.
    • Keys will not be reused (using a key twice with different values implicitly does an expensive remove).
    In order for allow for removes and adds to be called while an iterator is in use, iterator-responses use cloned key/value lists.
    Since:
    1.0
    Version:
    $Revision: 8102 $ $Date: 2006-04-25 16:09:10 -0600 (Tue, 25 Apr 2006) $
    Author:
    Gregory Block, Ralf Joachim
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      boolean containsKey​(java.lang.Object key)
      boolean containsValue​(java.lang.Object value)
      java.util.Set<java.util.Map.Entry<java.lang.Object,​java.lang.Object>> entrySet()
      java.lang.Object get​(java.lang.Object key)
      long getTimestamp()
      Returns the timestamp of this container.
      boolean isEmpty()
      java.util.Iterator<java.lang.Object> keyIterator()
      Returns an iterator over the keys contained in this container.
      java.util.Set<java.lang.Object> keySet()
      java.lang.Object put​(java.lang.Object key, java.lang.Object value)
      void putAll​(java.util.Map<? extends java.lang.Object,​? extends java.lang.Object> map)
      java.lang.Object remove​(java.lang.Object key)
      int size()
      void updateTimestamp()
      Set the timestamp of this container to System.currentTimeMillis().
      java.util.Iterator<java.lang.Object> valueIterator()
      Returns an iterator over the values contained in this container.
      java.util.Collection<java.lang.Object> values()
      • Methods inherited from class java.lang.Object

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

        compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
    • Constructor Detail

      • FastIteratingContainer

        public FastIteratingContainer()
    • Method Detail

      • updateTimestamp

        public void updateTimestamp()
        Set the timestamp of this container to System.currentTimeMillis().
        Specified by:
        updateTimestamp in interface Container
      • getTimestamp

        public long getTimestamp()
        Returns the timestamp of this container.
        Specified by:
        getTimestamp in interface Container
        Returns:
        The timestamp.
      • keyIterator

        public java.util.Iterator<java.lang.Object> keyIterator()
        Returns an iterator over the keys contained in this container. If the container is modified while an iteration is in progress, the results of the iteration is not affected and vice-versa.
        Specified by:
        keyIterator in interface Container
        Returns:
        An iterator over the keys currently contained in the container.
      • valueIterator

        public java.util.Iterator<java.lang.Object> valueIterator()
        Returns an iterator over the values contained in this container. If the container is modified while an iteration is in progress, the results of the iteration is not affected and vice-versa.
        Specified by:
        valueIterator in interface Container
        Returns:
        An iterator over the values currently contained in the container.
      • size

        public int size()
        Specified by:
        size in interface java.util.Map<java.lang.Object,​java.lang.Object>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface java.util.Map<java.lang.Object,​java.lang.Object>
      • containsKey

        public boolean containsKey​(java.lang.Object key)
        Specified by:
        containsKey in interface java.util.Map<java.lang.Object,​java.lang.Object>
      • containsValue

        public boolean containsValue​(java.lang.Object value)
        Specified by:
        containsValue in interface java.util.Map<java.lang.Object,​java.lang.Object>
      • get

        public java.lang.Object get​(java.lang.Object key)
        Specified by:
        get in interface java.util.Map<java.lang.Object,​java.lang.Object>
      • put

        public java.lang.Object put​(java.lang.Object key,
                                    java.lang.Object value)
        Specified by:
        put in interface java.util.Map<java.lang.Object,​java.lang.Object>
      • remove

        public java.lang.Object remove​(java.lang.Object key)
        Specified by:
        remove in interface java.util.Map<java.lang.Object,​java.lang.Object>
      • putAll

        public void putAll​(java.util.Map<? extends java.lang.Object,​? extends java.lang.Object> map)
        Specified by:
        putAll in interface java.util.Map<java.lang.Object,​java.lang.Object>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Map<java.lang.Object,​java.lang.Object>
      • keySet

        public java.util.Set<java.lang.Object> keySet()
        Specified by:
        keySet in interface java.util.Map<java.lang.Object,​java.lang.Object>
      • values

        public java.util.Collection<java.lang.Object> values()
        Specified by:
        values in interface java.util.Map<java.lang.Object,​java.lang.Object>
      • entrySet

        public java.util.Set<java.util.Map.Entry<java.lang.Object,​java.lang.Object>> entrySet()
        Specified by:
        entrySet in interface java.util.Map<java.lang.Object,​java.lang.Object>