Java Code Examples for com.google.common.collect.Multimaps#unmodifiableMultimap()
The following examples show how to use
com.google.common.collect.Multimaps#unmodifiableMultimap() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExpandCompositeTermsTest.java From datawave with Apache License 2.0 | 7 votes |
@BeforeClass public static void beforeClass() { Multimap<String,String> multimap = LinkedListMultimap.create(); multimap.clear(); multimap.put("MAKE_COLOR", "MAKE"); multimap.put("MAKE_COLOR", "COLOR"); multimap.put("COLOR_WHEELS", "COLOR"); multimap.put("COLOR_WHEELS", "WHEELS"); multimap.put("TEAM_NAME_POINTS", "TEAM"); multimap.put("TEAM_NAME_POINTS", "NAME"); multimap.put("TEAM_NAME_POINTS", "POINTS"); multimap.put("TEAM_POINTS", "TEAM"); multimap.put("TEAM_POINTS", "POINTS"); compositeToFieldMap = Multimaps.unmodifiableMultimap(multimap); Map<String,String> sepMap = new HashMap<>(); sepMap.put("MAKE_COLOR", ","); sepMap.put("COLOR_WHEELS", ","); sepMap.put("TEAM_NAME_POINTS", ","); sepMap.put("TEAM_POINTS", ","); compositeFieldSeparators = Collections.unmodifiableMap(sepMap); }
Example 2
Source File: TimelyUser.java From timely with Apache License 2.0 | 6 votes |
@JsonCreator public TimelyUser(@JsonProperty(value = "dn", required = true) SubjectIssuerDNPair dn, @JsonProperty(value = "userType", required = true) UserType userType, @JsonProperty("auths") Collection<String> auths, @JsonProperty("roles") Collection<String> roles, @JsonProperty("roleToAuthMapping") Multimap<String, String> roleToAuthMapping, @JsonProperty(value = "creationTime", defaultValue = "-1L") long creationTime, @JsonProperty(value = "expirationTime", defaultValue = "-1L") long expirationTime) { this.name = dn.toString(); this.commonName = DnUtils.getCommonName(dn.subjectDN()); this.dn = dn; this.userType = userType; this.auths = auths == null ? Collections.emptyList() : new LinkedHashSet<>(auths); this.unmodifiableAuths = Collections.unmodifiableCollection(this.auths); this.roles = roles == null ? Collections.emptyList() : new LinkedHashSet<>(roles); this.unmodifiableRoles = Collections.unmodifiableCollection(this.roles); this.roleToAuthMapping = roleToAuthMapping == null ? LinkedHashMultimap.create() : Multimaps.unmodifiableMultimap(LinkedHashMultimap.create(roleToAuthMapping)); this.creationTime = creationTime; this.expirationTime = expirationTime; }
Example 3
Source File: OperatorSpecGraphAnalyzer.java From samza with Apache License 2.0 | 6 votes |
public Multimap<SendToTableOperatorSpec, StreamTableJoinOperatorSpec> getSendToTableOpSpecToStreamTableJoinOpSpecs() { Multimap<SendToTableOperatorSpec, StreamTableJoinOperatorSpec> sendToTableOpSpecToStreamTableJoinOpSpecs = HashMultimap.create(); // Map every SendToTableOperatorSpec to all StreamTableJoinOperatorSpecs referencing the same table. for (String tableId : tableToSendToTableOpSpecs.keySet()) { Collection<SendToTableOperatorSpec> sendToTableOpSpecs = tableToSendToTableOpSpecs.get(tableId); Collection<StreamTableJoinOperatorSpec> streamTableJoinOpSpecs = tableToStreamTableJoinOpSpecs.get(tableId); for (SendToTableOperatorSpec sendToTableOpSpec : sendToTableOpSpecs) { sendToTableOpSpecToStreamTableJoinOpSpecs.putAll(sendToTableOpSpec, streamTableJoinOpSpecs); } } return Multimaps.unmodifiableMultimap(sendToTableOpSpecToStreamTableJoinOpSpecs); }
Example 4
Source File: WebSocketEnvelope.java From chassis with Apache License 2.0 | 6 votes |
/** * Generates the header cache. */ private synchronized void generateHeaderCache() { if (headerCache != null) { // already generated cache return; } // generate the multimap Multimap<String, String> headers = HashMultimap.create(); if (base.headers != null) { for (Header header : base.headers) { headers.putAll(header.name, header.value); } } headerCache = Multimaps.unmodifiableMultimap(headers); }
Example 5
Source File: HttpRequestImpl.java From brooklyn-server with Apache License 2.0 | 5 votes |
public HttpRequestImpl(HttpRequestImpl httpRequest) { this.uri = checkNotNull(httpRequest.uri, "uri"); this.method = checkNotNull(httpRequest.method, "method"); this.body = httpRequest.body; this.headers = Multimaps.unmodifiableMultimap(ArrayListMultimap.create(checkNotNull(httpRequest.headers, "headers"))); this.credentials = httpRequest.credentials; this.config = httpRequest.config; }
Example 6
Source File: VertexInfo.java From tez with Apache License 2.0 | 5 votes |
public final Multimap<Container, TaskAttemptInfo> getContainersMapping() { Multimap<Container, TaskAttemptInfo> containerMapping = LinkedHashMultimap.create(); for (TaskAttemptInfo attemptInfo : getTaskAttempts()) { containerMapping.put(attemptInfo.getContainer(), attemptInfo); } return Multimaps.unmodifiableMultimap(containerMapping); }
Example 7
Source File: TaskInfo.java From tez with Apache License 2.0 | 5 votes |
/** * Get the set of containers on which the task attempts ran for this task * * @return Multimap<Container, TaskAttemptInfo> task attempt details at container level */ public final Multimap<Container, TaskAttemptInfo> getContainersMapping() { Multimap<Container, TaskAttemptInfo> containerMapping = LinkedHashMultimap.create(); for (TaskAttemptInfo attemptInfo : getTaskAttempts()) { containerMapping.put(attemptInfo.getContainer(), attemptInfo); } return Multimaps.unmodifiableMultimap(containerMapping); }
Example 8
Source File: DagInfo.java From tez with Apache License 2.0 | 5 votes |
/** * Get containers used for this DAG * * @return Multimap<Container, TaskAttemptInfo> task attempt details at every container */ public final Multimap<Container, TaskAttemptInfo> getContainersToTaskAttemptMapping() { List<VertexInfo> VertexInfoList = getVertices(); Multimap<Container, TaskAttemptInfo> containerMapping = LinkedHashMultimap.create(); for (VertexInfo vertexInfo : VertexInfoList) { containerMapping.putAll(vertexInfo.getContainersMapping()); } return Multimaps.unmodifiableMultimap(containerMapping); }
Example 9
Source File: MultimapType.java From javers with Apache License 2.0 | 5 votes |
/** * @return immutable Multimap */ @Override public Multimap map(Object sourceEnumerable, EnumerableFunction mapFunction, OwnerContext owner) { Validate.argumentIsNotNull(mapFunction); Multimap sourceMultimap = toNotNullMultimap(sourceEnumerable); Multimap targetMultimap = ArrayListMultimap.create(); MapEnumerationOwnerContext enumeratorContext = new MapEnumerationOwnerContext(owner, true); MapType.mapEntrySet(sourceMultimap.entries(), mapFunction, enumeratorContext, (k,v) -> targetMultimap.put(k,v)); return Multimaps.unmodifiableMultimap(targetMultimap); }
Example 10
Source File: HttpRequestImpl.java From brooklyn-server with Apache License 2.0 | 5 votes |
protected HttpRequestImpl(HttpRequest.Builder builder) { this.uri = checkNotNull(builder.uri, "uri"); this.method = checkNotNull(builder.method, "method"); this.body = builder.body; this.headers = Multimaps.unmodifiableMultimap(ArrayListMultimap.create(checkNotNull(builder.headers, "headers"))); this.credentials = builder.credentials; this.config = builder.config; }
Example 11
Source File: ModuleDependenciesUtils.java From bundletool with Apache License 2.0 | 5 votes |
/** * Builds a map of module dependencies. * * <p>If module "a" contains {@code <uses-split name="b"/>} manifest entry, then the map contains * entry ("a", "b"). * * <p>All modules implicitly depend on the "base" module. Hence the map contains also dependency * ("base", "base"). */ public static Multimap<String, String> buildAdjacencyMap(ImmutableList<BundleModule> modules) { Multimap<String, String> moduleDependenciesMap = ArrayListMultimap.create(); for (BundleModule module : modules) { String moduleName = module.getName().getName(); AndroidManifest manifest = module.getAndroidManifest(); checkArgument( !moduleDependenciesMap.containsKey(moduleName), "Module named '%s' was passed in multiple times.", moduleName); moduleDependenciesMap.putAll(moduleName, manifest.getUsesSplits()); // Check that module does not declare explicit dependency on the "base" module // (whose split ID actually is empty instead of "base" anyway). if (moduleDependenciesMap.containsEntry(moduleName, BASE_MODULE_NAME.getName())) { throw InvalidBundleException.builder() .withUserMessage( "Module '%s' declares dependency on the '%s' module, which is implicit.", moduleName, BASE_MODULE_NAME) .build(); } // Add implicit dependency on the base. Also ensures that every module has a key in the map. moduleDependenciesMap.put(moduleName, BASE_MODULE_NAME.getName()); } return Multimaps.unmodifiableMultimap(moduleDependenciesMap); }
Example 12
Source File: BiMultiValMap.java From stratio-cassandra with Apache License 2.0 | 4 votes |
public Multimap<V, K> inverse() { return Multimaps.unmodifiableMultimap(reverseMap); }
Example 13
Source File: TwoWayMap.java From swift-t with Apache License 2.0 | 4 votes |
/** * @return an unmodifiable inverse view that will stay in sync */ public Multimap<V, K> inverse() { return Multimaps.unmodifiableMultimap(mapInv); }
Example 14
Source File: ArscBlamer.java From android-arscblamer with Apache License 2.0 | 4 votes |
/** Must first call {@link #blame}. */ public Multimap<TypeChunk.Entry, ResourceEntry> getTypeEntryToBlamedResources() { return Multimaps.unmodifiableMultimap(typeEntryToBlame); }
Example 15
Source File: DagInfo.java From tez with Apache License 2.0 | 4 votes |
public Multimap<Container, TaskAttemptInfo> getContainerMapping() { return Multimaps.unmodifiableMultimap(containerMapping); }
Example 16
Source File: ArscBlamer.java From android-arscblamer with Apache License 2.0 | 4 votes |
/** Must first call {@link #blame}. */ public Multimap<PackageChunk, ResourceEntry> getPackageToBlamedResources() { return Multimaps.unmodifiableMultimap(packageToBlame); }
Example 17
Source File: ProjectStateHolder.java From n4js with Eclipse Public License 1.0 | 4 votes |
/** * Return the validation issues as an unmodifiable map. */ public Multimap<URI, LSPIssue> getValidationIssues() { return Multimaps.unmodifiableMultimap(validationIssues); }