code: @SuppressWarnings("unchecked")
      public static <K, V> void addResult(final Map<K, List<V>> results, final K key, final Object value) {
          Validate.notNull(results, "Cannot add a result to a null map.");
          Validate.notNull(key, "Cannot add a result with a null key.");
  
          // don't put null values into the Map.
          if (value == null) {
              return;
          }
  
          List<V> currentValue = results.get(key);
          if (currentValue == null) {
              currentValue = new LinkedList<>();
              results.put(key, currentValue);
          }
  
          if (value instanceof List) {
              currentValue.addAll((List<V>) value);
          } else {
              currentValue.add((V) value);
          }
      }
docs: Adds a key/value pair to the specified {@link Map}, creating multi-valued
  values when appropriate.
  <br>
  Since multi-valued attributes end up with a value of type
  {@link List}, passing in a {@link List} of any type will
  cause its contents to be added to the <code>results</code>
  {@link Map} directly under the specified <code>key</code>
  
  @param <K> Key type (extends Object)
  @param <V> Value type (extends Object)
  @param results The {@link Map} to modify.
  @param key The key to add the value for.
  @param value The value to add for the key.
  @throws IllegalArgumentException if any argument is null