code: private static Map<String, String> dictionaryToMap( final Dictionary dictionary )
      {
          final Map<String, String> map = new HashMap<String, String>();
          try
          {
              // first try a shortcut
              if( dictionary instanceof Hashtable )
              {
                  map.putAll( (Hashtable<String, String>) dictionary );
              }
              else
              {
                  final Enumeration keys = dictionary.keys();
                  while( keys.hasMoreElements() )
                  {
                      final String key = (String) keys.nextElement();
                      map.put( key, (String) dictionary.get( key ) );
                  }
              }
              return map;
          }
          catch( ClassCastException e )
          {
              throw new IllegalArgumentException( "Dictionary entries must have String keys and values" );
          }
      }
docs: Converts a dictionary of String/String to a map.
  
  @param dictionary to be converted
  
  @return dictionary content as map
  
  @throws IllegalArgumentException if dictionary entries keys or values are not string