本文整理了Java中org.apache.brooklyn.util.collections.MutableMap.get()
方法的一些代码示例,展示了MutableMap.get()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MutableMap.get()
方法的具体详情如下:
包路径:org.apache.brooklyn.util.collections.MutableMap
类名称:MutableMap
方法名:get
暂无
代码示例来源:origin: io.brooklyn.ambari/brooklyn-ambari
protected Map<String, Map> mergeMaps(Map<String, Map> configuration, Map<String, Map> servicesConfig) {
if (servicesConfig == null) {
return configuration;
}
MutableMap<String, Map> newConfigurationMap = MutableMap.copyOf(configuration);
for (Map.Entry<String, Map> stringMapEntry : servicesConfig.entrySet()) {
if(!newConfigurationMap.containsKey(stringMapEntry.getKey())) {
newConfigurationMap.put(stringMapEntry.getKey(), stringMapEntry.getValue());
} else {
if(stringMapEntry.getValue() != null) {
// Ensuring that the configuration passed via yaml gets precedence over the one provided by the external service
MutableMap<String, Map> tmpMap = MutableMap.copyOf(stringMapEntry.getValue());
tmpMap.putAll(newConfigurationMap.get(stringMapEntry.getKey()));
newConfigurationMap.put(stringMapEntry.getKey(), ImmutableMap.copyOf(tmpMap));
}
}
}
return newConfigurationMap;
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-utils-common
public Maybe<V> getMaybe(K key) {
if (containsKey(key)) return Maybe.of(get(key));
return Maybe.absent("No entry for key '"+key+"' in this map");
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-utils-common
@SuppressWarnings("rawtypes")
@Test
public void testCreateMapInList1() {
MutableMap<Object, Object> map = Jsonya.at("countries").list().map().add("europe", "uk").getRootMap();
List l = (List)map.get("countries");
Assert.assertEquals( ((Map)l.get(0)).get("europe"), "uk" );
}
@SuppressWarnings("rawtypes")
代码示例来源:origin: org.apache.brooklyn/brooklyn-utils-common
/** convenience for converting an object x to something which consists only of json primitives, doing
* {@link #toString()} on anything which is not recognised. see {@link JsonPrimitiveDeepTranslator} */
public static Object convertToJsonPrimitive(Object x) {
if (x==null) return null;
if (x instanceof Map) return newInstancePrimitive().put((Map<?,?>)x).getRootMap();
return newInstancePrimitive().put("data", x).getRootMap().get("data");
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-utils-common
@SuppressWarnings("rawtypes")
@Test
public void testCreateMapInList2() {
MutableMap<Object, Object> map = Jsonya.at("countries").list().map().add("europe", "uk")
.root().at("countries").add("antarctica")
.root().at("countries").map().add("asia", (Object)null)
.at("asia").list().add("china", "japan").getRootMap();
List l = (List)map.get("countries");
Assert.assertEquals( ((Map)l.get(0)).get("europe"), "uk" );
}
内容来源于网络,如有侵权,请联系作者删除!