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:javalabra.shakki.engine.board.Tile.java
private static Map<Integer, EmptyTile> createAllPossibleEmptyTiles() { final Map<Integer, EmptyTile> emptyTileMap = new HashMap(); for (int i = 0; i < BoardUtils.NUM_TILES; i++) { emptyTileMap.put(i, new EmptyTile(i)); }/*ww w . j a v a 2s .c om*/ return ImmutableMap.copyOf(emptyTileMap); }
From source file:com.addthis.hydra.job.spawn.SpawnUtils.java
public static Map<String, Job> getJobsMapFromSpawnState(SpawnState spawnState) { return ImmutableMap.copyOf(spawnState.jobs); }
From source file:org.graylog2.plugin.MetricSets.java
public static MetricSet of(final Map<String, ? extends Metric> gauges) { return new MetricSet() { @Override//from w w w . j a va 2 s .co m public Map<String, Metric> getMetrics() { return ImmutableMap.copyOf(gauges); } }; }
From source file:com.facebook.buck.dotnet.DotnetAssumptions.java
public static void assumeCscIsAvailable() { Optional<Path> csc = new ExecutableFinder().getOptionalExecutable(Paths.get("csc"), ImmutableMap.copyOf(System.getenv())); assumeTrue("Unable to find csc", csc.isPresent()); }
From source file:com.facebook.presto.sql.planner.TypeProvider.java
public static TypeProvider copyOf(Map<Symbol, Type> types) { return new TypeProvider(ImmutableMap.copyOf(types)); }
From source file:org.jclouds.docker.internal.NullSafeCopies.java
public static <K, V> Map<K, V> copyOf(@Nullable Map<K, V> map) { return map != null ? ImmutableMap.copyOf(map) : ImmutableMap.<K, V>of(); }
From source file:com.facebook.buck.util.environment.EnvVariablesProvider.java
@SuppressWarnings("PMD.BlacklistedSystemGetenv") public static ImmutableMap<String, String> getSystemEnv() { if (Platform.detect().getType() == PlatformType.WINDOWS) { return System.getenv().entrySet().stream() .collect(ImmutableMap.toImmutableMap(e -> e.getKey().toUpperCase(), Map.Entry::getValue)); } else {/*from ww w . j a v a2 s . c om*/ return ImmutableMap.copyOf(System.getenv()); } }
From source file:ch.piratenpartei.pivote.model.util.CollectionProperties.java
public static <K, V> Map<K, V> copyOf(Map<K, V> of) { if (of == null) { return null; } else {/*from ww w.j a va 2 s. c o m*/ return ImmutableMap.copyOf(of); } }
From source file:com.blacklocus.misc.NoNullsMap.java
public static <K, V> ImmutableMap<K, V> of(K k1, V v1) { NoNullsMap<K, V> map = new NoNullsMap<K, V>(1); map.put(k1, v1);/* w ww . jav a 2 s .c o m*/ return ImmutableMap.copyOf(map); }
From source file:com.fizzbuzz.vroom.core.api.util.UriHelper.java
public static String formatUriTemplate(final String uriTemplate, final Map<String, String> uriTokenToValueMap) { String result = uriTemplate;/*from w w w .j a v a2 s. c o m*/ // make an defensive immutable copy of the provided map ImmutableMap<String, String> iMap = ImmutableMap.copyOf(uriTokenToValueMap); for (Map.Entry<String, String> entry : iMap.entrySet()) { result = result.replace(tokenize(entry.getKey()), entry.getValue()); } return result; }