本文整理汇总了Java中java.util.Collections.synchronizedSortedMap方法的典型用法代码示例。如果您正苦于以下问题:Java Collections.synchronizedSortedMap方法的具体用法?Java Collections.synchronizedSortedMap怎么用?Java Collections.synchronizedSortedMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.Collections
的用法示例。
在下文中一共展示了Collections.synchronizedSortedMap方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getChildrenGroups
import java.util.Collections; //导入方法依赖的package包/类
public List<SaasGroup> getChildrenGroups() {
if (children == null) {
children = Collections.synchronizedSortedMap(new TreeMap<String,SaasGroup>());
for (Group g : delegate.getGroup()) {
SaasGroup sg = new SaasGroup(this, g);
children.put(sg.getName(), sg);
}
}
return new ArrayList<SaasGroup>(children.values());
}
示例2: SaasGroup
import java.util.Collections; //导入方法依赖的package包/类
public SaasGroup(SaasGroup parent, Group group) {
this.parent = parent;
this.delegate = group;
services = Collections.synchronizedSortedMap(new TreeMap<String, Saas>());
}
示例3: MessageHeader
import java.util.Collections; //导入方法依赖的package包/类
MessageHeader() {
map = Collections.synchronizedSortedMap(new TreeMap<String, String>());
}
示例4: getObject
import java.util.Collections; //导入方法依赖的package包/类
protected SortedMap<String, String> getObject() {
SortedMap<String, String> map = new TreeMap<String, String>();
map.put("key", "value");
return Collections.synchronizedSortedMap(map);
}
示例5: getAnotherObject
import java.util.Collections; //导入方法依赖的package包/类
protected SortedMap<String, String> getAnotherObject() {
SortedMap<String, String> map = new TreeMap<String, String>();
return Collections.synchronizedSortedMap(map);
}
示例6: synchronizedSortedMap
import java.util.Collections; //导入方法依赖的package包/类
/**
* Returns a synchronized sorted map backed by the given sorted map.
* <p>
* You must manually synchronize on the returned buffer's iterator to
* avoid non-deterministic behavior:
*
* <pre>
* Map m = MapUtils.synchronizedSortedMap(myMap);
* Set s = m.keySet(); // outside synchronized block
* synchronized (m) { // synchronized on MAP!
* Iterator i = s.iterator();
* while (i.hasNext()) {
* process (i.next());
* }
* }
* </pre>
*
* This method uses the implementation in {@link java.util.Collections Collections}.
*
* @param <K> the key type
* @param <V> the value type
* @param map the map to synchronize, must not be null
* @return a synchronized map backed by the given map
* @throws NullPointerException if the map is null
*/
public static <K, V> SortedMap<K, V> synchronizedSortedMap(final SortedMap<K, V> map) {
return Collections.synchronizedSortedMap(map);
}