本文整理汇总了Java中com.google.common.collect.LinkedListMultimap.get方法的典型用法代码示例。如果您正苦于以下问题:Java LinkedListMultimap.get方法的具体用法?Java LinkedListMultimap.get怎么用?Java LinkedListMultimap.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.LinkedListMultimap
的用法示例。
在下文中一共展示了LinkedListMultimap.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateFeedMetaDataUrl
import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
@SuppressWarnings("ResultOfMethodCallIgnored")
public static void updateFeedMetaDataUrl(final Context context, final String feedUrl) {
final LinkedListMultimap<String, String> map = getFeedMetaData(context);
final int position = getCurrentFeedAdapterPosition(context);
int i = 0;
for (final String title : map.asMap().keySet()) {
if (i == position) {
final List<String> values = new ArrayList<>(map.get(title));
values.set(FEED_URL, feedUrl);
map.replaceValues(title, values);
putFeedMetaData(context, map);
break;
}
i++;
}
}
示例2: endVisit
import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
@Override
public void endVisit(FieldDeclaration node) {
LinkedListMultimap<Integer, VariableDeclarationFragment> newDeclarations =
rewriteExtraDimensions(node.getType(), node.getFragments());
if (newDeclarations != null) {
List<BodyDeclaration> bodyDecls = TreeUtil.getBodyDeclarations(node.getParent());
int location = 0;
while (location < bodyDecls.size() && !node.equals(bodyDecls.get(location))) {
location++;
}
for (Integer dimensions : newDeclarations.keySet()) {
List<VariableDeclarationFragment> fragments = newDeclarations.get(dimensions);
FieldDeclaration newDecl = new FieldDeclaration(fragments.get(0));
newDecl.getFragments().addAll(fragments.subList(1, fragments.size()));
bodyDecls.add(++location, newDecl);
}
}
}
示例3: getFeedMetaDataValues
import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
public static LinkedHashMap<String, String> getFeedMetaDataValues(final Context context) {
final LinkedListMultimap<String, String> map = getFeedMetaData(context);
final LinkedHashMap<String, String> values = new LinkedHashMap<>(map.asMap().size());
for (final String title : map.asMap().keySet()) {
final List<String>list = map.get(title);
values.put(list.get(FEED_URL), list.get(FEED_ID));
}
return values;
}
示例4: updateFeedIdAt
import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
@SuppressWarnings("ConstantConditions")
public static void updateFeedIdAt(final Context context, final int position,
final String id) {
final LinkedListMultimap<String, String> map = getFeedMetaData(context);
final String currentTitle = getFeedMetaDataTitleAt(context, position);
final List<String> values = new ArrayList<>(map.get(currentTitle));
values.set(FEED_ID, id);
map.replaceValues(currentTitle, values);
putFeedMetaData(context, map);
}
示例5: checkAndGet
import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
static List<String> checkAndGet(LinkedListMultimap<String,
String> headers, String header) {
List<String> result = new LinkedList<String>();
if (headers == null) {
result.add("");
return result;
}
List<String> values = headers.get(header);
if (values == null || values.isEmpty()) {
result.add("");
return result;
}
return values;
}
示例6: getExpires
import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
static long getExpires(URI uri) {
LinkedListMultimap<String, String> params = Utils.parseUriParameters(uri);
List<String> expires = params.get(Common.EXPIRES);
if (!expires.isEmpty()) {
return Long.parseLong(expires.get(0));
}
return 0;
}
示例7: getSingleHeader
import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
public static String getSingleHeader(String header,
LinkedListMultimap<String, String> headers) {
List<String> values = headers.get(header);
if (values == null) {
values = headers.get(header.toLowerCase());
}
if (values != null && !values.isEmpty()) {
return values.get(0);
}
return null;
}
示例8: getSingleParam
import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
public static String getSingleParam(String name, URI uri) {
LinkedListMultimap<String, String> params = parseUriParameters(uri);
if (params != null && !params.isEmpty()) {
List<String> values = params.get(name);
if (values == null) {
values = params.get(name.toLowerCase());
}
if (values != null & !values.isEmpty()) {
return values.get(0);
}
}
return null;
}
示例9: canonicalizeXiaomiHeaders
import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
static String canonicalizeXiaomiHeaders(
LinkedListMultimap<String, String> headers) {
if (headers == null) {
return "";
}
// 1. Sort the header and merge the values
Map<String, String> sortedHeaders = new TreeMap<String, String>();
for (String key : headers.keySet()) {
if (!key.toLowerCase().startsWith(HttpKeys.XIAOMI_HEADER_PREFIX)) {
continue;
}
StringBuilder builder = new StringBuilder();
int index = 0;
for (String value : headers.get(key)) {
if (index != 0) {
builder.append(",");
}
builder.append(value);
index++;
}
sortedHeaders.put(key, builder.toString());
}
// 3. Generate the canonicalized result
StringBuilder result = new StringBuilder();
for (Entry<String, String> entry : sortedHeaders.entrySet()) {
result.append(entry.getKey()).append(":")
.append(entry.getValue()).append("\n");
}
return result.toString();
}
示例10: canonicalizeResource
import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
static String canonicalizeResource(URI uri) {
StringBuilder result = new StringBuilder();
result.append(uri.getPath());
// 1. Parse and sort subresources
TreeMap<String, String> sortedParams = new TreeMap<String, String>();
LinkedListMultimap<String, String> params = parseUriParameters(uri);
for (String key : params.keySet()) {
for (String value : params.get(key)) {
if (SUB_RESOURCE_SET.contains(key)) {
sortedParams.put(key, value);
}
}
}
// 2. Generate the canonicalized result
if (!sortedParams.isEmpty()) {
result.append("?");
boolean isFirst = true;
for (Entry<String, String> entry : sortedParams.entrySet()) {
if (isFirst) {
isFirst = false;
result.append(entry.getKey());
} else {
result.append("&").append(entry.getKey());
}
if (!entry.getValue().isEmpty()) {
result.append("=").append(entry.getValue());
}
}
}
return result.toString();
}
示例11: checkAndGet
import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
static List<String> checkAndGet(LinkedListMultimap<String, String> headers,
String header) {
List<String> result = new LinkedList<String>();
if (headers == null) {
result.add("");
return result;
}
List<String> values = headers.get(header);
if (values == null || values.isEmpty()) {
result.add("");
return result;
}
return values;
}
示例12: getExpires
import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
static long getExpires(URI uri) {
LinkedListMultimap<String, String> params = parseUriParameters(uri);
List<String> expires = params.get(HttpKeys.EXPIRES);
if (expires != null && !expires.isEmpty()) {
return Long.parseLong(expires.get(0));
}
return 0;
}
示例13: getAccessKeyId
import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
public static String getAccessKeyId(URI uri) {
Preconditions.checkNotNull(uri);
String query = uri.getQuery();
if (query != null) {
LinkedListMultimap<String, String> params =
HttpUtils.parseUriParameters(uri);
List<String> keyIds = params.get(HttpKeys.GALAXY_ACCESS_KEY_ID);
if (!keyIds.isEmpty()) {
return params.get(HttpKeys.GALAXY_ACCESS_KEY_ID).get(0);
}
}
return null;
}
示例14: getSignature
import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
public static String getSignature(URI uri) {
Preconditions.checkNotNull(uri);
String query = uri.getQuery();
if (query != null) {
LinkedListMultimap<String, String> params =
HttpUtils.parseUriParameters(uri);
List<String> signatures = params.get(HttpKeys.SIGNATURE);
if (!signatures.isEmpty()) {
return params.get(HttpKeys.SIGNATURE).get(0);
}
}
return null;
}
示例15: getDateTime
import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
public static long getDateTime(LinkedListMultimap<String, String> headers) {
List<String> dateList = headers.get(HttpKeys.MI_DATE);
if (dateList.isEmpty()) {
dateList = headers.get(HttpKeys.DATE);
}
if (!dateList.isEmpty()) {
String datetime = dateList.get(0);
return HttpUtils.parseDateTimeToMilliseconds(datetime);
}
return 0;
}