本文整理汇总了Java中java.util.Collections.synchronizedSortedSet方法的典型用法代码示例。如果您正苦于以下问题:Java Collections.synchronizedSortedSet方法的具体用法?Java Collections.synchronizedSortedSet怎么用?Java Collections.synchronizedSortedSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.Collections
的用法示例。
在下文中一共展示了Collections.synchronizedSortedSet方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBackups
import java.util.Collections; //导入方法依赖的package包/类
public Collection getBackups() {
Collection backups = selector.select(new SelectCondition(), null);
SortedSet result = Collections.synchronizedSortedSet(new TreeSet(comp));
result.addAll(backups);
return result;
}
示例2: RotationManager
import java.util.Collections; //导入方法依赖的package包/类
public RotationManager(Logger logger, Configuration config, PGMMap defaultMap, Collection<RotationProviderInfo> providers) {
this.logger = ClassLogger.get(checkNotNull(logger, "logger"), getClass());
this.config = config;
this.providers = Collections.synchronizedSortedSet(Sets.newTreeSet(providers));
load(defaultMap);
}
示例3: PeerreviewServiceImpl
import java.util.Collections; //导入方法依赖的package包/类
PeerreviewServiceImpl() {
creatingUsersForSessionIds = Collections.synchronizedSortedSet(new TreeSet<Long>());
}
示例4: getObject
import java.util.Collections; //导入方法依赖的package包/类
protected SortedSet<String> getObject() {
SortedSet<String> set = new TreeSet<String>();
set.add("string");
return Collections.synchronizedSortedSet(set);
}
示例5: getAnotherObject
import java.util.Collections; //导入方法依赖的package包/类
protected SortedSet<String> getAnotherObject() {
SortedSet<String> set = new TreeSet<String>();
return Collections.synchronizedSortedSet(set);
}
示例6: synchronizedSortedSet
import java.util.Collections; //导入方法依赖的package包/类
/**
* Returns a synchronized sorted set backed by the given sorted set.
* <p>
* You must manually synchronize on the returned set's iterator to
* avoid non-deterministic behavior:
*
* <pre>
* Set s = SetUtils.synchronizedSortedSet(mySet);
* synchronized (s) {
* Iterator i = s.iterator();
* while (i.hasNext()) {
* process (i.next());
* }
* }
* </pre>
*
* This method is just a wrapper for {@link Collections#synchronizedSortedSet(SortedSet)}.
*
* @param <E> the element type
* @param set the sorted set to synchronize, must not be null
* @return a synchronized set backed by the given set
* @throws NullPointerException if the set is null
*/
public static <E> SortedSet<E> synchronizedSortedSet(final SortedSet<E> set) {
return Collections.synchronizedSortedSet(set);
}