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:co.cask.common.cli.Arguments.java
public Arguments(Map<String, String> arguments, String rawInput) { this.rawInput = rawInput; this.arguments = ImmutableMap.copyOf(arguments); }
From source file:org.retrostore.request.RequestDataImpl.java
public static RequestData create(final HttpServletRequest request, Type type, final BlobstoreService blobstoreService) { BlobProvider blobProvider = () -> { Map<String, List<BlobInfo>> blobInfos = blobstoreService.getBlobInfos(request); blobInfos = blobInfos != null ? blobInfos : new HashMap<>(); return ImmutableMap.copyOf(blobInfos); };//from w w w . jav a 2 s . c o m return new RequestDataImpl(request, type, blobProvider); }
From source file:io.airlift.drift.idl.generator.ThriftIdlGeneratorConfig.java
private ThriftIdlGeneratorConfig(String defaultPackage, Map<String, String> namespaces, Map<String, String> includes, boolean recursive, Consumer<String> errorLogger, Consumer<String> warningLogger, Consumer<String> verboseLogger) { this.defaultPackage = firstNonNull(defaultPackage, ""); this.namespaces = ImmutableMap.copyOf(firstNonNull(namespaces, ImmutableMap.of())); this.includes = ImmutableMap.copyOf(firstNonNull(includes, ImmutableMap.of())); this.recursive = recursive; this.errorLogger = firstNonNull(errorLogger, ignored -> { });/*from w w w. ja v a 2 s.com*/ this.warningLogger = firstNonNull(warningLogger, ignored -> { }); this.verboseLogger = firstNonNull(verboseLogger, ignored -> { }); }
From source file:azkaban.webapp.Status.java
Status(final String version, final String pid, final String installationPath, final long usedMemory, final long xmx, final boolean isDatabaseUp, final Map<Integer, Executor> executorStatusMap) { this.version = version; this.pid = pid; this.installationPath = installationPath; this.usedMemory = usedMemory; this.xmx = xmx; this.isDatabaseUp = isDatabaseUp; this.executorStatusMap = ImmutableMap.copyOf(executorStatusMap); }
From source file:com.cognifide.aet.communication.api.metadata.Operation.java
public Map<String, String> getParameters() { return parameters != null ? ImmutableMap.copyOf(parameters) : Collections.<String, String>emptyMap(); }
From source file:com.facebook.presto.plugin.jdbc.JdbcPlugin.java
@Override public void setOptionalConfig(Map<String, String> optionalConfig) { this.optionalConfig = ImmutableMap.copyOf(requireNonNull(optionalConfig, "optionalConfig is null")); }
From source file:org.tensorics.core.util.names.ImmutableNameRepository.java
/** * Creates a new name repository backed by the given map. * * @param objectNames the mapping from objects to names *//* w w w .j ava 2s .c o m*/ private ImmutableNameRepository(Map<Object, String> objectNames) { requireNonNull(objectNames, "objectNames must not be null"); this.objectNames = ImmutableMap.copyOf(objectNames); }
From source file:net.sf.lucis.core.Highlight.java
private static ImmutableMap<String, Integer> filter(Map<String, Integer> fields) { if (fields == null || fields.isEmpty()) { return ImmutableMap.of(); }// ww w .j a v a2s.c om return ImmutableMap.copyOf(Maps.filterEntries(fields, FILTER)); }
From source file:io.airlift.discovery.StaticAnnouncement.java
@JsonCreator public StaticAnnouncement(@JsonProperty("environment") String environment, @JsonProperty("type") String type, @JsonProperty("pool") String pool, @JsonProperty("location") String location, @JsonProperty("properties") Map<String, String> properties) { this.environment = environment; this.location = location; this.type = type; this.pool = pool; if (properties != null) { this.properties = ImmutableMap.copyOf(properties); } else {//from w ww .j ava2 s. c om this.properties = null; } }
From source file:com.github.jsdossier.soy.DossierSoyTypeProvider.java
DossierSoyTypeProvider() { Map<String, SoyType> map = new HashMap<>(); Descriptors.FileDescriptor fileDescriptor = Dossier.getDescriptor(); for (Descriptors.EnumDescriptor enumDescriptor : fileDescriptor.getEnumTypes()) { ProtoEnumSoyType type = ProtoEnumSoyType.get(enumDescriptor); map.put(type.getName(), type);// w w w .j a va 2 s .c om } for (Descriptors.Descriptor descriptor : fileDescriptor.getMessageTypes()) { registerTypes(map, descriptor); } types = ImmutableMap.copyOf(map); }