本文整理汇总了Java中com.google.common.collect.Multimaps.asMap方法的典型用法代码示例。如果您正苦于以下问题:Java Multimaps.asMap方法的具体用法?Java Multimaps.asMap怎么用?Java Multimaps.asMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.Multimaps
的用法示例。
在下文中一共展示了Multimaps.asMap方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doParse
import com.google.common.collect.Multimaps; //导入方法依赖的package包/类
@VisibleForTesting
protected GetAliasesResponse doParse(BytesReference bytesReference) {
try (XContentParser parser = XContentHelper.createParser(bytesReference)) {
ListMultimap<String, AliasMetaData> metaDatas = ArrayListMultimap.create();
XContentParser.Token token;
String currentFieldName = null;
while ((token = parser.nextToken()) != END_OBJECT) {
if (token == XContentParser.Token.FIELD_NAME) {
currentFieldName = parser.currentName();
} else if (token == START_OBJECT) {
if (currentFieldName != null) { // we are at an index metadata start
List<AliasMetaData> aliasMetaDatas = parseAliases(parser);
metaDatas.putAll(currentFieldName, aliasMetaDatas);
}
}
}
Map<String, List<AliasMetaData>> map = Multimaps.asMap(metaDatas);
aliases = ImmutableOpenMap.<String, List<AliasMetaData>>builder().putAll(map).build();
return this;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
示例2: getConditionValues
import com.google.common.collect.Multimaps; //导入方法依赖的package包/类
public static Map<String, List<Double>> getConditionValues(BufferedDataTable table, String id, Function f) {
ListMultimap<String, Double> values = ArrayListMultimap.create();
for (DataRow row : getRowsById(table, id)) {
Map<String, Double> newValues = new LinkedHashMap<>();
for (String var : f.getIndependentVariables()) {
newValues.put(var, IO.getDouble(row.getCell(table.getSpec().findColumnIndex(var))));
}
if (newValues.values().stream().allMatch(v -> v != null && Double.isFinite(v))) {
newValues.forEach((var, value) -> values.put(var, value));
}
}
return Multimaps.asMap(values);
}
示例3: getVariableValues
import com.google.common.collect.Multimaps; //导入方法依赖的package包/类
public static Map<String, List<Double>> getVariableValues(BufferedDataTable table, String id, Function f,
Map<String, Double> fixed) {
ListMultimap<String, Double> values = ArrayListMultimap.create();
for (DataRow row : getRowsById(table, id)) {
Map<String, Double> newValues = new LinkedHashMap<>();
for (String var : f.getVariables()) {
newValues.put(var, IO.getDouble(row.getCell(table.getSpec().findColumnIndex(var))));
}
if (newValues.values().stream().allMatch(v -> v != null && Double.isFinite(v))
&& fixed.entrySet().stream().allMatch(e -> e.getValue().equals(newValues.get(e.getKey())))) {
newValues.forEach((var, value) -> values.put(var, value));
}
}
return Multimaps.asMap(values);
}
示例4: getDiffVariableValues
import com.google.common.collect.Multimaps; //导入方法依赖的package包/类
public static Map<String, List<Double>> getDiffVariableValues(BufferedDataTable table, String id, Function f) {
ListMultimap<String, Double> values = ArrayListMultimap.create();
for (DataRow row : getRowsById(table, id)) {
Double time = IO.getDouble(row.getCell(table.getSpec().findColumnIndex(f.getTimeVariable())));
Double target = IO.getDouble(row.getCell(table.getSpec().findColumnIndex(f.getDependentVariable())));
if (time != null && target != null && Double.isFinite(time) && Double.isFinite(target)) {
values.put(f.getTimeVariable(), time);
values.put(f.getDependentVariable(), target);
}
}
return Multimaps.asMap(values);
}
示例5: listTableColumns
import com.google.common.collect.Multimaps; //导入方法依赖的package包/类
@Override
public Map<SchemaTableName, List<ColumnMetadata>> listTableColumns(ConnectorSession session, SchemaTablePrefix prefix)
{
requireNonNull(prefix, "prefix is null");
ImmutableListMultimap.Builder<SchemaTableName, ColumnMetadata> columns = ImmutableListMultimap.builder();
for (TableColumn tableColumn : dao.listTableColumns(prefix.getSchemaName(), prefix.getTableName())) {
if (tableColumn.getColumnName().equals(SAMPLE_WEIGHT_COLUMN_NAME)) {
continue;
}
ColumnMetadata columnMetadata = new ColumnMetadata(tableColumn.getColumnName(), tableColumn.getDataType(), false);
columns.put(tableColumn.getTable(), columnMetadata);
}
return Multimaps.asMap(columns.build());
}
示例6: processResultSet
import com.google.common.collect.Multimaps; //导入方法依赖的package包/类
@Override
public Map<String, List<String>> processResultSet(ResultSet resultSet) throws Exception {
ListMultimap<String, String> multimap = ArrayListMultimap.create();
while (resultSet.next()) {
multimap.put(resultSet.getString(1), resultSet.getString(2));
}
return Multimaps.asMap(multimap);
}
示例7: getPossibleValues
import com.google.common.collect.Multimaps; //导入方法依赖的package包/类
public static Map<String, Set<String>> getPossibleValues(Collection<? extends Element> elements) {
SetMultimap<String, String> values = LinkedHashMultimap.create();
for (Element e : elements) {
e.getProperties().forEach((property, value) -> {
if (value instanceof Boolean) {
values.putAll(property, Arrays.asList(Boolean.FALSE.toString(), Boolean.TRUE.toString()));
} else if (value != null) {
values.put(property, value.toString());
}
});
}
return Multimaps.asMap(values);
}
示例8: getWarnings
import com.google.common.collect.Multimaps; //导入方法依赖的package包/类
public static Map<String, Set<String>> getWarnings(Connection conn) {
boolean useSerialAsID = hasUniqueSerials(conn);
SetMultimap<String, String> warnings = LinkedHashMultimap.create();
getDeliveries(conn, getStationIds(conn, useSerialAsID), getDeliveryIds(conn, useSerialAsID), warnings);
return Multimaps.asMap(warnings);
}
示例9: getSessions
import com.google.common.collect.Multimaps; //导入方法依赖的package包/类
@RequestMapping(value = "sessions", method = RequestMethod.GET)
@ResponseBody
public Map<Long, List<String>> getSessions() {
return Multimaps.asMap(sessionManager.getSessions());
}
示例10: AbstractSortedSetMapResultRowMapper
import com.google.common.collect.Multimaps; //导入方法依赖的package包/类
protected AbstractSortedSetMapResultRowMapper(SortedSetMultimap<K, V> results) {
this(results, Multimaps.asMap(results));
}
示例11: AbstractSetMapResultRowMapper
import com.google.common.collect.Multimaps; //导入方法依赖的package包/类
protected AbstractSetMapResultRowMapper(SetMultimap<K, V> results) {
this(results, Multimaps.asMap(results));
}
示例12: AbstractListMapResultRowMapper
import com.google.common.collect.Multimaps; //导入方法依赖的package包/类
protected AbstractListMapResultRowMapper(ListMultimap<K, V> results) {
this(results, Multimaps.asMap(results));
}
示例13: getClassesInfo
import com.google.common.collect.Multimaps; //导入方法依赖的package包/类
public Map<String, Collection<FieldInfo>> getClassesInfo() {
return Multimaps.asMap(mJobInfo);
}