Java Code Examples for java.util.Collections.synchronizedSortedSet()

The following are Jave code examples for showing how to use synchronizedSortedSet() of the java.util.Collections class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: ProjectAres   File: RotationManager.java   View Source Code Vote up 5 votes
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);
}
 
Example 2
Project: ralasafe   File: BackupManagerImpl.java   View Source Code Vote up 4 votes
public Collection getBackups() {
	Collection backups = selector.select(new SelectCondition(), null);
	SortedSet result = Collections.synchronizedSortedSet(new TreeSet(comp));
	result.addAll(backups);
	return result;
}
 
Example 3
Project: lams   File: PeerreviewServiceImpl.java   View Source Code Vote up 4 votes
PeerreviewServiceImpl() {
creatingUsersForSessionIds = Collections.synchronizedSortedSet(new TreeSet<Long>());
   }
 
Example 4
Project: jdk8u-jdk   File: java_util_Collections_SynchronizedSortedSet.java   View Source Code Vote up 4 votes
protected SortedSet<String> getObject() {
    SortedSet<String> set = new TreeSet<String>();
    set.add("string");
    return Collections.synchronizedSortedSet(set);
}
 
Example 5
Project: jdk8u-jdk   File: java_util_Collections_SynchronizedSortedSet.java   View Source Code Vote up 4 votes
protected SortedSet<String> getAnotherObject() {
    SortedSet<String> set = new TreeSet<String>();
    return Collections.synchronizedSortedSet(set);
}
 
Example 6
Project: openjdk-jdk10   File: java_util_Collections_SynchronizedSortedSet.java   View Source Code Vote up 4 votes
protected SortedSet<String> getObject() {
    SortedSet<String> set = new TreeSet<String>();
    set.add("string");
    return Collections.synchronizedSortedSet(set);
}
 
Example 7
Project: openjdk-jdk10   File: java_util_Collections_SynchronizedSortedSet.java   View Source Code Vote up 4 votes
protected SortedSet<String> getAnotherObject() {
    SortedSet<String> set = new TreeSet<String>();
    return Collections.synchronizedSortedSet(set);
}
 
Example 8
Project: HCFCore   File: SetUtils.java   View Source Code Vote up 2 votes
/**
 * 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);
}
 
Example 9
Project: HCFCore   File: SetUtils.java   View Source Code Vote up 2 votes
/**
 * 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);
}