Example usage for com.google.common.collect ImmutableListMultimap of

List of usage examples for com.google.common.collect ImmutableListMultimap of

Introduction

In this page you can find the example usage for com.google.common.collect ImmutableListMultimap of.

Prototype

public static <K, V> ImmutableListMultimap<K, V> of(K k1, V v1) 

Source Link

Document

Returns an immutable multimap containing a single entry.

Usage

From source file:de.metas.ui.web.window.datatypes.LookupValuesList.java

public static final LookupValuesList fromNullable(final LookupValue lookupValue) {
    if (lookupValue == null) {
        return EMPTY;
    }/*from w  w w .  j  a  v a2  s.c  om*/

    final ImmutableListMultimap<Object, LookupValue> valuesById = ImmutableListMultimap.of(lookupValue.getId(),
            lookupValue);
    final Map<String, String> debugProperties = ImmutableMap.of();
    return new LookupValuesList(valuesById, debugProperties);
}

From source file:org.n52.iceland.util.http.MediaType.java

/**
 * Constructs a <code>type&#47;subtype;parameter="name"</code> media type.
 *
 * @param type// w  w w .j  a v  a2s  .  c  o m
 *            the type (may be <code>null</code> for a wild card)
 * @param subtype
 *            the subtype (may be <code>null</code> for a wild card)
 * @param parameter
 *            the parameter
 * @param parameterValue
 *            the parameter value
 */
public MediaType(String type, String subtype, String parameter, String parameterValue) {
    this(type, subtype,
            ImmutableListMultimap.of(checkNotNull(parameter).toLowerCase(), checkNotNull(parameterValue)));
}

From source file:io.wcm.caravan.pipeline.impl.JsonPipelineFactoryImpl.java

@Override
public JsonPipeline createEmpty(Map<String, String> contextProperties) {

    CaravanHttpRequest dummyRequest = new CaravanHttpRequestBuilder("").build();

    // make sure to set a Cache-Control header to mark the empty response as indefinitely cacheable,
    // otherwise the default max-age value of zero would become effective
    ImmutableListMultimap<String, String> headers = ImmutableListMultimap.of("Cache-Control",
            "max-age=" + Long.toString(TimeUnit.DAYS.toSeconds(365)));

    CaravanHttpResponse emptyJsonResponse = new CaravanHttpResponseBuilder().status(200).reason("OK")
            .headers(headers).body("{}", Charset.forName("UTF-8")).build();

    return new JsonPipelineImpl(dummyRequest, Observable.just(emptyJsonResponse), new JsonPipelineContextImpl(
            this, createMultiLayerCacheAdapter(), metricRegistry, contextProperties));
}