Example usage for com.google.common.collect LinkedHashMultimap replaceValues

List of usage examples for com.google.common.collect LinkedHashMultimap replaceValues

Introduction

In this page you can find the example usage for com.google.common.collect LinkedHashMultimap replaceValues.

Prototype

@Override
public Set<V> replaceValues(@Nullable K key, Iterable<? extends V> values) 

Source Link

Document

If values is not empty and the multimap already contains a mapping for key , the keySet() ordering is unchanged.

Usage

From source file:io.helixservice.core.util.VertxTypeConverter.java

/**
 * Vert.x MultiMap to Guava Multimap./*  www  .  j  ava2s.c  om*/
 * Primarily used for request and response headers.
 *
 * @param multiMap Vert.x multimap
 * @return Multimap converted to Guava Multimap
 */
static Multimap<String, String> toGuavaMultimap(MultiMap multiMap) {
    LinkedHashMultimap<String, String> result = LinkedHashMultimap.create();

    for (String key : multiMap.names()) {
        result.replaceValues(key, multiMap.getAll(key));
    }

    return result;
}