List of usage examples for com.google.common.collect Multimaps unmodifiableMultimap
@Deprecated public static <K, V> Multimap<K, V> unmodifiableMultimap(ImmutableMultimap<K, V> delegate)
From source file:org.apache.tez.history.parser.datamodel.DagInfo.java
/** * Get containers used for this DAG//from w w w .ja v a 2s. co m * * @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); }
From source file:org.apache.shindig.gadgets.http.HttpResponse.java
/** * Expected layout://from w w w. ja v a 2 s .c o m * * int - status code * Map<String, List<String>> - headers * int - length of body * byte array - body, of previously specified length */ @SuppressWarnings("unchecked") public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { httpStatusCode = in.readInt(); // We store the multimap as a Map<String,List<String>> to insulate us from google-collections API churn // And to remain backwards compatible Map<String, List<String>> headerCopyMap = (Map<String, List<String>>) in.readObject(); Multimap headerCopy = newHeaderMultimap(); for (Map.Entry<String, List<String>> entry : headerCopyMap.entrySet()) { headerCopy.putAll(entry.getKey(), entry.getValue()); } int bodyLength = in.readInt(); responseBytes = new byte[bodyLength]; int cnt, offset = 0; while ((cnt = in.read(responseBytes, offset, bodyLength)) > 0) { offset += cnt; bodyLength -= cnt; } if (offset != responseBytes.length) { throw new IOException( "Invalid body! Expected length = " + responseBytes.length + ", bytes readed = " + offset + '.'); } date = getAndUpdateDate(headerCopy); encoding = getAndUpdateEncoding(headerCopy, responseBytes); headers = Multimaps.unmodifiableMultimap(headerCopy); metadata = Collections.emptyMap(); }
From source file:org.cloudsmith.geppetto.pp.dsl.linking.PPFinder.java
/** * Produces an unmodifiable Multimap mapping from last segment to list of visible exports * ending with that value.//from ww w.ja v a 2s . c o m * * @return */ public Multimap<String, IEObjectDescription> getExportedPerLastSegement() { return Multimaps.unmodifiableMultimap(exportedPerLastSegment); }