List of usage examples for com.google.common.collect ImmutableMap copyOf
public static <K, V> ImmutableMap<K, V> copyOf(Iterable<? extends Entry<? extends K, ? extends V>> entries)
From source file:org.apache.samza.metadatastore.InMemoryMetadataStore.java
@Override public Map<String, byte[]> all() { return ImmutableMap.copyOf(memStore); }
From source file:org.onosproject.l3vpn.netl3vpn.impl.L3VpnModelRegistrator.java
private static Map<YangModuleId, AppModuleInfo> getAppInfo() { Map<YangModuleId, AppModuleInfo> appInfo = new HashMap<>(); appInfo.put(new DefaultYangModuleId("ietf-inet-types", "2013-00-15"), new DefaultAppModuleInfo(IetfInetTypes.class, null)); appInfo.put(new DefaultYangModuleId("ietf-l3vpn-svc", "2016-00-30"), new DefaultAppModuleInfo(IetfL3VpnSvc.class, null)); appInfo.put(new DefaultYangModuleId("ietf-yang-types", "2013-00-15"), new DefaultAppModuleInfo(IetfYangTypes.class, null)); appInfo.put(new DefaultYangModuleId("l3vpn-svc-ext", "2016-00-30"), new DefaultAppModuleInfo(L3VpnSvcExt.class, null)); return ImmutableMap.copyOf(appInfo); }
From source file:com.prealpha.minelib.nbt.CompoundTag.java
@Override public ByteBuffer toBytes() { // make copies to avoid encoding twice Map<String, ByteBuffer> nameBytes = ImmutableMap .copyOf(Maps.transformEntries(value, new EntryTransformer<String, Tag, ByteBuffer>() { @Override//from w ww .j ava 2 s. c o m public ByteBuffer transformEntry(String key, Tag value) { return new StringTag(key).toBytes(); } })); Map<String, ByteBuffer> payloadBytes = ImmutableMap.copyOf(Maps.transformValues(value, Tag.ENCODER)); int length = 1; // for the null terminating byte for (ByteBuffer buffer : nameBytes.values()) { length += buffer.capacity() + 1; // add one for the tagType } for (ByteBuffer buffer : payloadBytes.values()) { length += buffer.capacity(); } ByteBuffer payload = ByteBuffer.allocate(length); for (String name : value.keySet()) { payload.put(value.get(name).getTagType().getBinaryType()); payload.put(nameBytes.get(name)); payload.put(payloadBytes.get(name)); } payload.put((byte) 0x00); payload.position(0); return payload; }
From source file:com.sk89q.guavabackport.cache.AbstractLoadingCache.java
@Override public ImmutableMap<K, V> getAll(final Iterable<? extends K> keys) throws ExecutionException { final Map<K, V> result = Maps.newLinkedHashMap(); for (final K key : keys) { if (!result.containsKey(key)) { result.put(key, this.get(key)); }/*from w w w. j a v a2s . c o m*/ } return ImmutableMap.copyOf(result); }
From source file:org.apache.cassandra.schema.ReplicationParams.java
private ReplicationParams(Class<? extends AbstractReplicationStrategy> klass, Map<String, String> options) { this.klass = klass; this.options = ImmutableMap.copyOf(options); }
From source file:org.apache.aurora.scheduler.testing.FakeStatsProvider.java
/** * Gets the current values of all exported stats. * * @return All exported stat names and their associated values. *//*w w w . j a v a 2 s . com*/ public Map<String, ? extends Number> getAllValues() { return ImmutableMap.copyOf(Maps.transformValues(stats, Supplier::get)); }
From source file:org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializationFactory.java
/** * Constructor//from w w w . j a va 2 s .c o m */ public DeserializationFactory() { final Map<TypeToClassKey, Class<?>> temp = new HashMap<>(); TypeToClassMapInitializer.initializeTypeToClassMap(temp); // Register type to class map for additional deserializers TypeToClassMapInitializer.initializeAdditionalTypeToClassMap(temp); messageClassMap = ImmutableMap.copyOf(temp); }
From source file:org.apache.bigtop.bigpetstore.datagenerator.generators.purchase.StaticPurchasingModelSampler.java
public StaticPurchasingModelSampler(Map<ProductCategory, Sampler<DiscretePDF<Product>>> categorySamplers) { this.categorySamplers = ImmutableMap.copyOf(categorySamplers); }
From source file:org.jclouds.vcloud.options.CatalogItemOptions.java
/** * optional properties for the CatalogItem */// www . j a v a 2 s . c o m public CatalogItemOptions properties(Map<String, String> properties) { this.properties = ImmutableMap.copyOf(checkNotNull(properties, "properties")); return this; }
From source file:info.gehrels.voting.web.applicationState.ElectionCalculationsState.java
public ImmutableMap<DateTime, AsyncElectionCalculation> getHistoryOfElectionCalculations() { return ImmutableMap.copyOf(historyOfElectionCalculations); }