本文整理了Java中scala.collection.mutable.Map.toMap()
方法的一些代码示例,展示了Map.toMap()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Map.toMap()
方法的具体详情如下:
包路径:scala.collection.mutable.Map
类名称:Map
方法名:toMap
暂无
代码示例来源:origin: twosigma/beakerx
@Override
public Object deserialize(JsonNode n, ObjectMapper mapper) {
HashMap<String, Object> o = new HashMap<String, Object>();
try {
logger.debug("using custom map deserializer");
Iterator<Map.Entry<String, JsonNode>> e = n.fields();
while (e.hasNext()) {
Map.Entry<String, JsonNode> ee = e.next();
o.put(ee.getKey(), parent.deserialize(ee.getValue(), mapper));
}
} catch (Exception e) {
logger.error("exception deserializing Map {}", e.getMessage());
o = null;
}
if (o != null)
return JavaConverters.mapAsScalaMapConverter(o).asScala().toMap(Predef.<Tuple2<String, Object>>conforms());
return null;
}
代码示例来源:origin: twosigma/beakerx
@SuppressWarnings("unchecked")
@Override
public Object deserialize(JsonNode n, ObjectMapper mapper) {
org.apache.commons.lang3.tuple.Pair<String, Object> deserializeObject = TableDisplayDeSerializer.getDeserializeObject(parent, n, mapper);
String subtype = deserializeObject.getLeft();
if (subtype != null && subtype.equals(TableDisplay.DICTIONARY_SUBTYPE)) {
return JavaConverters.mapAsScalaMapConverter((Map<String, Object>) deserializeObject.getRight()).asScala().toMap(Predef.<Tuple2<String, Object>>conforms());
} else if (subtype != null && subtype.equals(TableDisplay.LIST_OF_MAPS_SUBTYPE)) {
List<Map<String, Object>> rows = (List<Map<String, Object>>) deserializeObject.getRight();
List<Object> oo = new ArrayList<Object>();
for (Map<String, Object> row : rows) {
oo.add(JavaConverters.mapAsScalaMapConverter(row).asScala().toMap(Predef.<Tuple2<String, Object>>conforms()));
}
return scala.collection.JavaConversions.collectionAsScalaIterable(oo);
} else if (subtype != null && subtype.equals(TableDisplay.MATRIX_SUBTYPE)) {
List<List<?>> matrix = (List<List<?>>) deserializeObject.getRight();
ArrayList<Object> ll = new ArrayList<Object>();
for (List<?> ob : matrix) {
ll.add(scala.collection.JavaConversions.asScalaBuffer(ob).toList());
}
return scala.collection.JavaConversions.asScalaBuffer(ll).toList();
}
return deserializeObject.getRight();
}
代码示例来源:origin: uber/marmaray
public static <K, V> scala.collection.immutable.Map<K, V> toScalaMap(@NonNull final Map<K, V> javaMap) {
return JavaConverters.mapAsScalaMapConverter(javaMap).asScala().toMap(Predef.<Tuple2<K, V>>conforms());
}
代码示例来源:origin: uber/hudi
public static <K, V> Map<K, V> toScalaMap(HashMap<K, V> m) {
return JavaConverters.mapAsScalaMapConverter(m).asScala().toMap(Predef.conforms());
}
代码示例来源:origin: com.uber.hoodie/hoodie-utilities
public static <K, V> Map<K, V> toScalaMap(HashMap<K, V> m) {
return JavaConverters.mapAsScalaMapConverter(m).asScala().toMap(Predef.conforms());
}
代码示例来源:origin: org.locationtech.geomesa/geomesa-jobs
@SuppressWarnings("unchecked")
public static void configureDataStore(Job job, Map<String, String> dataStoreParams) {
Object m = JavaConverters.mapAsScalaMapConverter(dataStoreParams).asScala();
scala.collection.immutable.Map<String, String> scalaParams =
((scala.collection.mutable.Map<String, String>) m).toMap(Predef.<Tuple2<String, String>>conforms());
GeoMesaOutputFormat$.MODULE$.configureDataStore(job, scalaParams);
}
}
代码示例来源:origin: org.locationtech.geomesa/geomesa-accumulo-jobs
@SuppressWarnings("unchecked")
public static void configure(Job job, Map<String, String> dataStoreParams, Query query) {
Object m = JavaConverters.mapAsScalaMapConverter(dataStoreParams).asScala();
scala.collection.immutable.Map<String, String> scalaParams =
((scala.collection.mutable.Map<String, String>) m).toMap(Predef.<Tuple2<String, String>>conforms());
GeoMesaAccumuloInputFormat$.MODULE$.configure(job, scalaParams, query);
}
代码示例来源:origin: org.locationtech.geomesa/geomesa-accumulo-jobs
@Deprecated
@SuppressWarnings("unchecked")
public static void configure(Job job,
Map<String, String> dataStoreParams,
String featureTypeName,
String filter,
String[] transform) {
Object m = JavaConverters.mapAsScalaMapConverter(dataStoreParams).asScala();
scala.collection.immutable.Map<String, String> scalaParams =
((scala.collection.mutable.Map<String, String>) m).toMap(Predef.<Tuple2<String, String>>conforms());
Option<String> f = Option.apply(filter);
Option<String[]> t = Option.apply(transform);
GeoMesaAccumuloInputFormat$.MODULE$.configure(job, scalaParams, featureTypeName, f, t);
}
}
代码示例来源:origin: apache/incubator-sentry
private Map<Resource, scala.collection.immutable.Set<Acl>> getAclsForRoles(final List<String> roles) {
return scala.collection.JavaConverters.mapAsScalaMapConverter(
rolePrivilegesToResourceAcls(getRoleToPrivileges(roles)))
.asScala().toMap(Predef.<Tuple2<Resource, scala.collection.immutable.Set<Acl>>>conforms());
}
内容来源于网络,如有侵权,请联系作者删除!