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