本文整理匯總了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);
}