/** * A convenience method for creating a synchronized SortedSet. * * @param self a SortedSet * @return a synchronized SortedSet * @see java.util.Collections#synchronizedSortedSet(java.util.SortedSet) * @since 1.0 */ public static <T> SortedSet<T> asSynchronized(SortedSet<T> self) { return Collections.synchronizedSortedSet(self); }
/** * 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); }
classes.add(Collections.synchronizedSet(Collections.emptySet()).getClass()); classes.add(Collections.synchronizedSortedMap(Collections.emptySortedMap()).getClass()); classes.add(Collections.synchronizedSortedSet(Collections.emptySortedSet()).getClass());
synchronizedSortedSet = Collections.synchronizedSortedSet(ts); synchronizedList = Collections.synchronizedList(ll); synchronizedRandomAccessList = Collections
final SortedSet<Long> ids = Collections.synchronizedSortedSet(new TreeSet<>()); // TODO Change to SkipList w/JDK6 final AtomicReference<Exception> exception = new AtomicReference<>(null);
boolean sameSizeVarSetFlag = false; SortedSet testSet = Collections.synchronizedSortedSet(new TreeSet(new SelectResultsComparator())); for (int i = 0; i < 10; i++) { Random rand = new Random();
sortedParamConverterProviders = Collections.synchronizedSortedSet(parent == null ? new TreeSet<>() : new TreeSet<>(parent.getSortedParamConverterProviders())); stringParameterUnmarshallers = parent == null ? new ConcurrentHashMap<>() : new ConcurrentHashMap<>(parent.getStringParameterUnmarshallers()); reactiveClasses = parent == null ? new ConcurrentHashMap<>() : new ConcurrentHashMap<>(parent.reactiveClasses);
@Override public Object create( final Object sourceCollection ) { return Collections.synchronizedSortedSet( (SortedSet<?>) sourceCollection ); } },
/** * A convenience method for creating a synchronized SortedSet. * * @param self a SortedSet * @return a synchronized SortedSet * @see java.util.Collections#synchronizedSortedSet(java.util.SortedSet) * @since 1.0 */ public static <T> SortedSet<T> asSynchronized(SortedSet<T> self) { return Collections.synchronizedSortedSet(self); }
@Override public Object create( final Object sourceCollection ) { return Collections.synchronizedSortedSet( (SortedSet<?>) sourceCollection ); } },
/** * A convenience method for creating a synchronized SortedSet. * * @param self a SortedSet * @return a synchronized SortedSet * @see java.util.Collections#synchronizedSortedSet(java.util.SortedSet) */ public static SortedSet asSynchronized(SortedSet self) { return Collections.synchronizedSortedSet(self); }
.synchronizedSortedSet(new TreeSet<>(parent.getSortedParamConverterProviders()));
protected SortedSet<MemoryStoreEntry> getRowsForIndex(final String id) { SortedSet<MemoryStoreEntry> set = storeData.get(id); if (set == null) { set = Collections.synchronizedSortedSet(new TreeSet<MemoryStoreEntry>()); storeData.put(id, set); } return set; }
.synchronizedSortedSet(new TreeSet<>(parent.getSortedParamConverterProviders()));
protected SortedSet<DependencyNode> getSortedSetOfLeftDependents(int nodeIndex) { SortedSet<DependencyNode> leftDependents = Collections.synchronizedSortedSet(new TreeSet<DependencyNode>()); for (int i = 1; i < nodeIndex; i++) { if (nodeIndex == nodes.get(i).getHeadIndex()) { leftDependents.add(nodes.get(i)); } } return leftDependents; }
public SortedSet<DependencyNode> getHeads() { SortedSet<DependencyNode> heads = Collections.synchronizedSortedSet(new TreeSet<DependencyNode>()); DependencyNode head = getHead(); if (head != null) { heads.add(head); } return heads; }
public SQLExecutionMonitor(SQLExecutionMonitorObserver parent) { this.parent = parent; completionCounter = new AtomicLong(0L); interval = parent.getInterval(); initialDelay = parent.getInitialDelay(); this.UNPROCESSED_FAILOVER_THRESHOLD = parent.getUnprocessedFailoverThreshold(); this.EXPECTED_TIME_TO_COMPLETE = parent.getExpectedCompletionTime() * MILISECOND; innerSet = Collections.synchronizedSortedSet(new TreeSet<TestObject>()); timer = new Timer(); }
private void reset() { // set all values back to their default values (used for running // the algorithm more than once) // nodes = new TreeSet<OENode>(heuristic); searchTree = new SynchronizedSearchTree(heuristic); //Sets.synchronizedNavigableSet(new TreeSet<OENode>(Collections.reverseOrder(heuristic))); descriptions = Collections.synchronizedSortedSet(new TreeSet<>()); bestEvaluatedDescriptions.getSet().clear(); expressionTests = 0; highestAccuracy = 0.0; }
protected TerracottaTreeCache(int mapImpl) { this.mapImpl = mapImpl; if (isThreadSafe) { cacheTree = Collections.synchronizedSortedMap(new TreeMap<Fqn,Map>(new Fqn())); fqnSet = Collections.synchronizedSortedSet(new TreeSet<Fqn>(new Fqn())); } else { cacheTree = new TreeMap<Fqn,Map>(new Fqn()); fqnSet = new TreeSet<Fqn>(new Fqn()); } }
protected TerracottaTreeCache(boolean isThreadSafe) { if (isThreadSafe) { cacheTree = Collections.synchronizedSortedMap(new TreeMap<Fqn,Map>(new Fqn())); fqnSet = Collections.synchronizedSortedSet(new TreeSet<Fqn>(new Fqn())); } else { cacheTree = new TreeMap<Fqn,Map>(new Fqn()); fqnSet = new TreeSet<Fqn>(new Fqn()); } }