本文整理汇总了Java中com.google.common.collect.LinkedListMultimap.put方法的典型用法代码示例。如果您正苦于以下问题:Java LinkedListMultimap.put方法的具体用法?Java LinkedListMultimap.put怎么用?Java LinkedListMultimap.put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.LinkedListMultimap
的用法示例。
在下文中一共展示了LinkedListMultimap.put方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createIssuerMap
import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
/**
* Returns a map of curve names to issuer details where the curve
* configuration type is {@link IssuerCurveTypeConfiguration}.
*
* @param configTypes the configuration types of the curves, keyed by curve name
* @return a map of curve names to issuer details where the curve
* configuration type is {@link IssuerCurveTypeConfiguration}
*/
private LinkedListMultimap<String, Pair<Object, LegalEntityFilter<LegalEntity>>> createIssuerMap(
Multimap<String, CurveTypeConfiguration> configTypes) {
LinkedListMultimap<String, Pair<Object, LegalEntityFilter<LegalEntity>>> results = LinkedListMultimap.create();
for (Map.Entry<String, CurveTypeConfiguration> entry : configTypes.entries()) {
String curveName = entry.getKey();
CurveTypeConfiguration configType = entry.getValue();
if (configType instanceof IssuerCurveTypeConfiguration) {
IssuerCurveTypeConfiguration issuerType = (IssuerCurveTypeConfiguration) configType;
results.put(curveName, Pairs.<Object, LegalEntityFilter<LegalEntity>>of(issuerType.getKeys(), issuerType.getFilters()));
}
}
return results;
}
示例2: addSession
import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
/**
*
* @param sid
* @param serverType
* @param sequence
* @param localSession
* @return
*/
public LocalSession addSession(String serverId,String serverType,int sessionId,LocalSession localSession) {
if (localSession == null) {
return null;
}
localSession.setServerId(serverId);
localSession.setServerType(serverType);
localSession.setId(sessionId);
localSession.setlistener(this.closeListener);
localSession.setStatus(ISession.STATUS_WORKING);
sessionBySid.put(serverId, localSession);
synchronized(sessionByStype) {
LinkedListMultimap<String, LocalSession> multimap = sessionByStype.get(serverType);
if (multimap == null) {
multimap = LinkedListMultimap.create();
sessionByStype.put(serverType, multimap);
}
multimap.put(serverId, localSession);
}
return localSession;
}
示例3: forField
import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
/**
*
* @param field the field for which the data is needed
* @return a multimap that can contain one or more values per date.
*/
public Multimap<OffsetDateTime, TypedObject> forField(IntradayTickField field) {
Map<OffsetDateTime, TypedObject> fieldData = data.column(field);
LinkedListMultimap<OffsetDateTime, TypedObject> multimap = LinkedListMultimap.create(fieldData.size());
for (Map.Entry<OffsetDateTime, TypedObject> e : fieldData.entrySet()) {
TypedObject v = e.getValue();
if (v.isList()) {
for (TypedObject value : v.asList()) {
multimap.put(e.getKey(), value);
}
} else {
multimap.put(e.getKey(), v);
}
}
return multimap;
}
示例4: call
import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
@Override
public <T> ActualResultWithBody<T> call(HttpRequest value, Class<? extends T> clazz) throws IOException {
HttpResponse response = makeRequest(value);
T body;
StatusLine statusLine = response.getStatusLine();
if (statusLine.getStatusCode() == 200) {
InputStream content = response.getEntity().getContent();
body = mapper.readValue(content, clazz);
} else {
LOG.warn("Repsonse was '{}' with reason '{}'", statusLine.getStatusCode(), statusLine.getReasonPhrase());
body = null;
}
LinkedListMultimap<String, String> headers = LinkedListMultimap.create();
for (Header header : response.getAllHeaders()) {
headers.put(header.getName(), header.getValue());
}
return new ActualResultWithBody<>(
statusLine.getStatusCode(),
statusLine.getReasonPhrase(),
headers,
Optional.ofNullable(body)
);
}
示例5: mergeResults
import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
private DependentBinariesResolvedResult mergeResults(Collection<DependentBinariesResolvedResult> results) {
DependentBinariesResolvedResult first = results.iterator().next();
if (results.size() == 1) {
return first;
}
boolean hasNotBuildables = false;
boolean hasTestSuites = false;
LinkedListMultimap<LibraryBinaryIdentifier, DependentBinariesResolvedResult> index = LinkedListMultimap.create();
List<DependentBinariesResolvedResult> allChildren = Lists.newArrayList();
for (DependentBinariesResolvedResult result : results) {
if (!result.isBuildable()) {
hasNotBuildables = true;
}
if (result.isTestSuite()) {
hasTestSuites = true;
}
allChildren.addAll(result.getChildren());
for (DependentBinariesResolvedResult child : result.getChildren()) {
index.put(child.getId(), child);
}
}
List<DependentBinariesResolvedResult> children = Lists.newArrayList();
for (Collection<DependentBinariesResolvedResult> childResults : index.asMap().values()) {
children.add(mergeResults(childResults));
}
return new DefaultDependentBinariesResolvedResult(first.getId(), first.getProjectScopedName(), !hasNotBuildables, hasTestSuites, children);
}
示例6: test_for_multimap
import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
public void test_for_multimap() throws Exception {
LinkedListMultimap map = LinkedListMultimap.create();
map.put("name", "a");
map.put("name", "b");
String json = JSON.toJSONString(map);
assertEquals("{\"name\":[\"a\",\"b\"]}", json);
}
示例7: testCreate
import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
@Test
public void testCreate() {
LinkedListMultimap<String, String> linkedListMultimap = LinkedListMultimap.create();
linkedListMultimap.put("user", "jim");
linkedListMultimap.put("user", "jim");
linkedListMultimap.put("user", "jack");
linkedListMultimap.put("user", "jack");
System.out.println(linkedListMultimap); // {user=[jim, jim, jack, jack]}
}
示例8: addEntry
import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
public XPath addEntry(XPathElement element, ACTIONS action, ATTRIBUTES attributes, XPathValues values) {
XPathAttributes xPathAttributes = new XPathAttributes(attributes, values);
LinkedListMultimap<XPathElement, LinkedList<ACTIONS>> newElementActionMap = LinkedListMultimap.create();
newElementActionMap.put(element, new LinkedList<ACTIONS>() {{
add(action);
}});
LinkedListMultimap<LinkedListMultimap<XPathElement, LinkedList<ACTIONS>>, LinkedListMultimap<ATTRIBUTES, XPathValues>> xpathListMap = LinkedListMultimap.create();
xpathListMap.put(newElementActionMap, xPathAttributes.getXpathAttributesListMap());
IXPath.xpathListMap.putAll(xpathListMap);
return this;
}
示例9: docToMultimap
import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
public LinkedListMultimap docToMultimap(Document d) {
LinkedListMultimap<String, String> m = LinkedListMultimap.create();
for (IndexableField f : d.getFields()) {
m.put(f.name(), f.stringValue());
}
return m;
}
示例10: Enricher
import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
/**
* Creates a new instance taking functions from the passed builder.
*
* <p>Also adds {@link MessageEnrichment}s for all enrichments defined in Protobuf.
*/
protected Enricher(AbstractBuilder<? extends Enricher, ?> builder) {
final LinkedListMultimap<Class<?>, EnrichmentFunction<?, ?, ?>> funcMap = create();
for (EnrichmentFunction<?, ?, ?> function : builder.getFunctions()) {
funcMap.put(function.getSourceClass(), function);
}
putMsgEnrichers(funcMap);
this.functions = ImmutableMultimap.copyOf(funcMap);
}
示例11: rewriteExtraDimensions
import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
private LinkedListMultimap<Integer, VariableDeclarationFragment> rewriteExtraDimensions(
Type typeNode, List<VariableDeclarationFragment> fragments) {
// Removes extra dimensions on variable declaration fragments and creates extra field
// declaration nodes if necessary.
// eg. "int i1, i2[], i3[][];" becomes "int i1; int[] i2; int[][] i3".
LinkedListMultimap<Integer, VariableDeclarationFragment> newDeclarations = null;
int masterDimensions = -1;
Iterator<VariableDeclarationFragment> iter = fragments.iterator();
while (iter.hasNext()) {
VariableDeclarationFragment frag = iter.next();
int dimensions = frag.getExtraDimensions();
ITypeBinding binding = frag.getVariableBinding().getType();
if (masterDimensions == -1) {
masterDimensions = dimensions;
if (dimensions != 0) {
typeNode.replaceWith(Type.newType(binding));
}
} else if (dimensions != masterDimensions) {
if (newDeclarations == null) {
newDeclarations = LinkedListMultimap.create();
}
VariableDeclarationFragment newFrag = new VariableDeclarationFragment(
frag.getVariableBinding(), TreeUtil.remove(frag.getInitializer()));
newDeclarations.put(dimensions, newFrag);
iter.remove();
} else {
frag.setExtraDimensions(0);
}
}
return newDeclarations;
}
示例12: headerArray2MultiValuedMap
import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
private LinkedListMultimap<String, String> headerArray2MultiValuedMap(Header[] headers) {
LinkedListMultimap<String, String> m = LinkedListMultimap.create();
if (headers != null)
for (Header h : headers) {
m.put(h.getName(), h.getValue());
}
return m;
}
示例13: parseUriParameters
import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
public static LinkedListMultimap<String, String> parseUriParameters(URI uri) {
LinkedListMultimap<String, String> params = LinkedListMultimap.create();
String query = uri.getQuery();
if (query != null) {
for (String param : query.split("&")) {
String[] kv = param.split("=");
if (kv.length >= 2) {
params.put(kv[0], param.substring(kv[0].length() + 1));
} else {
params.put(kv[0], "");
}
}
}
return params;
}
示例14: parseUriParameters
import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
private static LinkedListMultimap<String, String> parseUriParameters(URI uri) {
LinkedListMultimap<String, String> params = LinkedListMultimap.create();
String query = uri.getQuery();
if (query != null) {
for (String param : query.split("&")) {
String[] kv = param.split("=");
if (kv.length >= 2) {
params.put(kv[0], param.substring(kv[0].length() + 1));
} else {
params.put(kv[0], "");
}
}
}
return params;
}
示例15: setAuthenticationHeaders
import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
/**
* Set signature related headers when credential is properly set
*/
private MetricsHttpClient setAuthenticationHeaders(HttpPost post, byte[] data) {
if (this.client != null && credential != null) {
if (credential.getSecretKeyId() != null) {
String host = this.host.toHostString();
host = host.split(":")[0];
post.setHeader(AuthenticationConstants.HK_HOST, host);
// timestamp
String timestamp = Long.toString(clock.getCurrentEpoch());
post.setHeader(AuthenticationConstants.HK_TIMESTAMP, timestamp);
post.setHeader(HttpKeys.MI_DATE, HttpUtils.getGMTDatetime(new Date()));
// content md5
String md5 = BytesUtil
.bytesToHex(DigestUtil.digest(DigestUtil.DigestAlgorithm.MD5, data));
post.setHeader(com.xiaomi.infra.galaxy.sds.thrift.AuthenticationConstants.HK_CONTENT_MD5, md5);
LinkedListMultimap<String, String> headers = LinkedListMultimap.create();
for (Header header : post.getAllHeaders()) {
headers.put(header.getName().toLowerCase(), header.getValue());
}
try {
String authString = "Galaxy-V3 "
+ credential.getSecretKeyId()
+ ":"
+ Signer.signToBase64(HttpMethod.POST, post.getURI(), headers,
credential.getSecretKey(), SignAlgorithm.HmacSHA1);
post.setHeader(AuthenticationConstants.HK_AUTHORIZATION, authString);
} catch (Exception e) {
throw new RuntimeException("Failed to sign", e);
}
} else {
throw new RuntimeException("SecretKeyId must not be null");
}
}
return this;
}