Package collections

Class MapExample

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Map<java.lang.String,​java.lang.Integer> map
      Wrapped map.
    • Constructor Summary

      Constructors 
      Constructor Description
      MapExample​(java.util.Map<java.lang.String,​java.lang.Integer> map)
      Creates a new map wrapper.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void dump()
      Dumps map to the console.
      java.util.Map getMap()
      Returns wrapped map.
      void read​(java.lang.String file)
      Count number of words in the specified file.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • map

        private final java.util.Map<java.lang.String,​java.lang.Integer> map
        Wrapped map.
    • Constructor Detail

      • MapExample

        public MapExample​(java.util.Map<java.lang.String,​java.lang.Integer> map)
        Creates a new map wrapper.
        Parameters:
        map - map to wrap.
    • Method Detail

      • read

        public void read​(java.lang.String file)
                  throws java.io.IOException
        Count number of words in the specified file.
        Parameters:
        file - file to read.
        Throws:
        java.io.IOException - if an I/O error occurred.
      • dump

        public void dump()
        Dumps map to the console.
      • getMap

        public java.util.Map getMap()
        Returns wrapped map.
        Returns:
        wrapped map.