code: public void addParameters( Map newParams, boolean encoded ) {
          if ( newParams == null )
              throw new IllegalArgumentException("Cannot add null map of parameters.");
  
          if ( newParams.size() == 0 )
              return;
  
          if(_parameters == null) {
              _parameters = new QueryParameters();
              _opaque = false;
              setSchemeSpecificPart( null );
          }
  
          Iterator keys = newParams.keySet().iterator();
          while ( keys.hasNext() )
          {
              String name = ( String ) keys.next();
              String encodedName = name;
  
              if ( !encoded ) { encodedName = encode( name ); }
  
              Object newValue = newParams.get( name );
              if ( newValue == null )
              {
                  addParameter(encodedName, null, false);
              }
              else if ( newValue instanceof String )
              {
                  addValue( encodedName, ( String ) newValue, encoded );
              }
              else if ( newValue instanceof String[] )
              {
                  String newValues[] = ( String[] ) newValue;
                  for ( int i = 0; i < newValues.length; i++ )
                  {
                      addValue( encodedName, newValues[i], encoded );
                  }
              }
              else if ( newValue instanceof List )
              {
                  Iterator newValues = ( ( List ) newValue ).iterator();
                  while ( newValues.hasNext() )
                  {
                      addValue( encodedName, newValues.next().toString(), encoded );
                  }
              }
              else /* Convert other objects to a string */
              {
                  addValue( encodedName, newValue.toString(), encoded );
              }
          }
      }
docs: <p>
  Adds all the parameters in a {@link Map} to a URI's query string.
  </p>
  <p>
  If the encoded flag is true then this method assumes that
  the name and value do not need encoding or are already encoded
  correctly. Otherwise, it translates the name and value with the
  character encoding of this URI and adds them to the set of
  parameters for the query. If the encoding for this URI has
  not been set, then the default encoding used is "UTF-8".
  </p>
  <p>
  The query parameters are added in the order the keys of the Map.
  </p>
  
  @param newParams the map of new parameters to add to the URI
  @param encoded Flag indicating whether the names and values are already encoded.