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

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

Introduction

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

Prototype

public static <K, V> ImmutableMap<K, V> of() 

Source Link

Usage

From source file:com.facebook.buck.rules.FakeCellPathResolver.java

public FakeCellPathResolver(ProjectFilesystem projectFilesystem) {
    this(projectFilesystem, ImmutableMap.of());
}

From source file:keywhiz.api.CreateGroupRequest.java

public CreateGroupRequest(@JsonProperty("name") String name,
        @Nullable @JsonProperty("description") String description,
        @Nullable @JsonProperty("metadata") ImmutableMap<String, String> metadata) {
    this.name = name;
    this.description = description;
    this.metadata = metadata == null ? ImmutableMap.of() : ImmutableMap.copyOf(metadata);
}

From source file:com.opengamma.strata.basics.currency.CurrencyDataLoader.java

/**
 * Loads the available currencies./*w  w w  . j  a  v a2 s . c o m*/
 * 
 * @param loadHistoric  whether to load the historic or active currencies
 * @return the map of known currencies
 */
static ImmutableMap<String, Currency> loadCurrencies(boolean loadHistoric) {
    try {
        IniFile ini = ResourceConfig.combinedIniFile(ResourceConfig.orderedResources(CURRENCY_INI));
        return parseCurrencies(ini, loadHistoric);

    } catch (RuntimeException ex) {
        // logging used because this is loaded in a static variable
        log.severe(Throwables.getStackTraceAsString(ex));
        // return an empty instance to avoid ExceptionInInitializerError
        return ImmutableMap.of();
    }
}

From source file:com.google.devtools.build.lib.actions.EmptyRunfilesSupplier.java

@Override
public ImmutableMap<PathFragment, Map<PathFragment, Artifact>> getMappings() {
    return ImmutableMap.of();
}

From source file:com.facebook.presto.sql.planner.assertions.SymbolAliases.java

public SymbolAliases() {
    this.map = ImmutableMap.of();
}

From source file:org.opendaylight.yangtools.yang.data.impl.schema.nodes.UnmodifiableChildrenMap.java

/**
 * Create an unmodifiable view of a particular map. Does not perform unnecessary
 * encapsulation if the map is known to be already unmodifiable.
 *
 * @param map Backing map//from   w  w  w  . j av  a2s  .c o  m
 * @return Unmodifiable view
 */
static Map<PathArgument, DataContainerChild<? extends PathArgument, ?>> create(
        final Map<PathArgument, DataContainerChild<? extends PathArgument, ?>> map) {
    if (map instanceof UnmodifiableChildrenMap) {
        return map;
    }
    if (map instanceof ImmutableMap) {
        return map;
    }
    if (map.isEmpty()) {
        return ImmutableMap.of();
    }
    if (map.size() < WRAP_THRESHOLD) {
        return ImmutableMap.copyOf(map);
    }

    return new UnmodifiableChildrenMap(map);
}

From source file:com.palantir.atlasdb.keyvalue.impl.TableSplittingKeyValueService.java

public static TableSplittingKeyValueService create(List<KeyValueService> delegates,
        Map<String, KeyValueService> delegateByTable) {
    Map<String, KeyValueService> delegateByNamespace = ImmutableMap.of();
    return create(delegates, delegateByTable, delegateByNamespace);
}

From source file:org.apache.druid.server.lookup.cache.polling.OnHeapPollingCache.java

public OnHeapPollingCache(Iterable<Map.Entry<K, V>> entries) {

    if (entries == null) {
        immutableMap = ImmutableMap.of();
        immutableReverseMap = ImmutableMap.of();
    } else {//from w  w  w .  j  ava2  s  .  c  o m
        ImmutableSet.Builder<V> setOfValuesBuilder = ImmutableSet.builder();
        ImmutableMap.Builder<K, V> mapBuilder = ImmutableMap.builder();
        for (Map.Entry<K, V> entry : entries) {
            setOfValuesBuilder.add(entry.getValue());
            mapBuilder.put(entry.getKey(), entry.getValue());
        }
        final Set<V> setOfValues = setOfValuesBuilder.build();
        immutableMap = mapBuilder.build();
        immutableReverseMap = ImmutableMap
                .copyOf(Maps.asMap(setOfValues, val -> immutableMap.keySet().stream().filter(key -> {
                    V retVal = immutableMap.get(key);
                    return retVal != null && retVal.equals(val);
                }).collect(Collectors.toList())));
    }

}

From source file:ninja.leaping.permissionsex.backend.sql.Segment.java

static Segment empty(int id) {
    return new Segment(id, ImmutableSet.of(), ImmutableMap.of(), ImmutableMap.of(), ImmutableList.of(), null,
            null);//w  ww . jav  a2s  .  c o m
}

From source file:com.google.devtools.build.lib.packages.NativeInfo.java

public NativeInfo(NativeProvider<?> provider) {
    super(provider, Location.BUILTIN);
    this.values = ImmutableMap.of();
}