Tabnine Logo
MultiMap.put
Code IndexAdd Tabnine to your IDE (free)

How to use
put
method
in
org.apache.commons.collections4.MultiMap

Best Java code snippets using org.apache.commons.collections4.MultiMap.put (Showing top 8 results out of 315)

origin: org.apache.commons/commons-collections4

/**
 * Provides checking for adding the index.
 *
 * @param object the object to index
 * @throws IllegalArgumentException if the object maps to an existing key and the index
 *   enforces a uniqueness constraint
 */
private void addToIndex(final C object) {
  final K key = keyTransformer.transform(object);
  if (uniqueIndex && index.containsKey(key)) {
    throw new IllegalArgumentException("Duplicate key in uniquely indexed collection.");
  }
  index.put(key, object);
}
origin: org.apache.commons/commons-collections4

/**
 * Populates a MultiMap using the supplied <code>Transformer</code>s to transform the elements
 * into keys and values.
 *
 * @param <K>  the key type
 * @param <V>  the value type
 * @param <E>  the type of object contained in the {@link Iterable}
 * @param map the <code>MultiMap</code> to populate.
 * @param elements the <code>Iterable</code> containing the input values for the map.
 * @param keyTransformer the <code>Transformer</code> used to transform the element into a key value
 * @param valueTransformer the <code>Transformer</code> used to transform the element into a value
 * @throws NullPointerException if the map, collection or transformers are null
 */
public static <K, V, E> void populateMap(final MultiMap<K, V> map, final Iterable<? extends E> elements,
                     final Transformer<E, K> keyTransformer,
                     final Transformer<E, V> valueTransformer) {
  final Iterator<? extends E> iter = elements.iterator();
  while (iter.hasNext()) {
    final E temp = iter.next();
    map.put(keyTransformer.transform(temp), valueTransformer.transform(temp));
  }
}
origin: info.magnolia.cache/magnolia-cache-core

private void appendHeader(String name, Object value) {
  if (responseExpirationCalculator != null) {
    responseExpirationCalculator.addHeader(name, value);
  }
  headers.put(name, value);
}
origin: info.magnolia.cache/magnolia-cache-core

private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
  in.defaultReadObject();
  headers = new MultiValueMap();
  Iterator iter = serializableHeadersBackingList.entrySet().iterator();
  while (iter.hasNext()) {
    Map.Entry entry = (Entry) iter.next();
    Collection c = (Collection) entry.getValue();
    for (Iterator ic = c.iterator(); ic.hasNext();) {
      headers.put(entry.getKey(), ic.next());
    }
  }
  serializableHeadersBackingList = null;
}
origin: info.magnolia.cache/magnolia-cache-core

private void replaceHeader(String name, Object value) {
  if (responseExpirationCalculator != null) {
    responseExpirationCalculator.addHeader(name, value);
  }
  headers.remove(name);
  headers.put(name, value);
}
origin: dkpro/dkpro-similarity

public CMUdict(Reader reader)
  throws IOException, PronouncingDictionaryException
{
  String line;
  int lineNumber = 0;
  final Pattern cmuPattern = Pattern.compile("(.+?)(\\(\\d+\\))?  (.*)");
  final BufferedReader bufRead = new BufferedReader(reader);
  dict = new MultiValueMap();
  while ((line = bufRead.readLine()) != null) {
    lineNumber++;
    if (line.length() < 3) {
      throw new PronouncingDictionaryException(
          "syntax error on line " + lineNumber);
    }
    // Skip comment lines
    if (line.substring(0, 3).equals(";;;")) {
      continue;
    }
    Matcher m = cmuPattern.matcher(line);
    if (!m.find()) {
      throw new PronouncingDictionaryException(
          "syntax error on line " + lineNumber);
    }
    dict.put(m.group(1), m.group(3));
  }
  bufRead.close();
}
origin: dkpro/dkpro-similarity

for (Element grapheme : graphemes) {
  for (Element phoneme : phonemes) {
    dict.put(grapheme.getText(), phoneme.getText());
origin: info.magnolia.cache/magnolia-cache-core

  @Test
  public void replay() throws Exception {
    // GIVEN
    MultiMap headers = new MultiValueMap();
    headers.put(CacheConstants.HEADER_CACHE_CONTROL, CacheConstants.HEADER_VALUE_NO_CACHE);

    when(response.containsHeader(CacheConstants.HEADER_CACHE_CONTROL)).thenReturn(true);

    cachedEntry = new ContentCachedEntry("contentType", "characterEncoding", 0, headers, 0l, "originalUrl", 0) {
      @Override
      protected void writeContent(HttpServletRequest request, HttpServletResponse response, FilterChain chain, boolean acceptsGzipEncoding) throws IOException, ServletException {
      }

      @Override
      protected boolean canServeGzipContent() {
        return false;
      }
    };
    // WHEN
    cachedEntry.replay(request, response, null);

    // THEN
    verify(response).setHeader(CacheConstants.HEADER_CACHE_CONTROL, CacheConstants.HEADER_VALUE_NO_CACHE);
  }
}
org.apache.commons.collections4MultiMapput

Javadoc

Adds the value to the collection associated with the specified key.

Unlike a normal Map the previous value is not replaced. Instead the new value is added to the collection stored against the key. The collection may be a List, Set or other collection dependent on implementation.

Popular methods of MultiMap

  • get
    Gets the collection of values associated with the specified key. The returned value will implement C
  • clear
  • containsKey
  • entrySet
  • keySet
  • remove
    Removes all values associated with the specified key. Implementations typically return null from a s

Popular in Java

  • Reactive rest calls using spring rest template
  • notifyDataSetChanged (ArrayAdapter)
  • findViewById (Activity)
  • runOnUiThread (Activity)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • JTextField (javax.swing)
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now