Refine search
public SerializedForm(Result result) { fCount = result.count; fIgnoreCount = result.ignoreCount; assumptionFailureCount = result.assumptionFailureCount; fFailures = Collections.synchronizedList(new ArrayList<Failure>(result.failures)); fRunTime = result.runTime.longValue(); fStartTime = result.startTime.longValue(); }
@Override public void registerListener(String switcherName, SwitcherListener listener) { List listeners = Collections.synchronizedList(new ArrayList()); List preListeners= listenerMap.putIfAbsent(switcherName, listeners); if (preListeners == null) { listeners.add(listener); } else { preListeners.add(listener); } }
public <T> void registerImplementer(Class<T> configInterface, Class<? extends T> ...implementation) { List<Class> set; if (registry.containsKey(configInterface)) { set = registry.get(configInterface); } else {//TODO: concurrency issue -jj (someone sets set before putIfAbsent) List<Class> newSet = Collections.synchronizedList(new ArrayList<>()); set = registry.putIfAbsent(configInterface, newSet); if (set == null) { set = newSet; } } set.addAll(Arrays.asList(implementation)); }
/** * Constructs a basic coalescence animation. * * @param rootConfig {@link CoalesceConfig} The root object of the animation. This is simply the first item in * item in the animation list. */ public CoalesceAnimation3D(CoalesceConfig rootConfig) { mCoalesceObjects = Collections.synchronizedList(new CopyOnWriteArrayList<CoalesceConfig>()); mThetaRanges = Collections.synchronizedList(new CopyOnWriteArrayList<Double>()); mTransformable3D = rootConfig.object; mCoalesceObjects.add(rootConfig); mThetaRanges.add(rootConfig.spiral.calculateThetaForRadius(rootConfig.endProximity)); }
public void registerConfigChangedCallback(ConfigChangedCallback listener) { if (listener == null || mCallbackList == null) { mCallbackList = Collections.synchronizedList(new ArrayList<WeakReference<ConfigChangedCallback>>()); } for (WeakReference<ConfigChangedCallback> configReferer : mCallbackList) { if (listener.equals(configReferer.get())) { return; } } mCallbackList.add(new WeakReference<ConfigChangedCallback>(listener)); }
/** * Get the notes list for the given location. If missing, create it. */ private List<RouteNote> getOrCreateNotes(Point location) { List<RouteNote> notes = Collections.synchronizedList(new ArrayList<RouteNote>()); List<RouteNote> prevNotes = routeNotes.putIfAbsent(location, notes); return prevNotes != null ? prevNotes : notes; }
private List<Class<?>> findSubclasses(Map<URL, String> locations, String searchingPackageName) { List<Class<?>> v = synchronizedList(new ArrayList<Class<?>>()); List<Class<?>> w = null; for (URL url : locations.keySet()) { // search just required packages String packageName = locations.get(url); if (packageName.startsWith(searchingPackageName)) { w = findSubclasses(url, packageName, searchingPackageName); if (w != null && w.size() > 0) { v.addAll(w); } } } return v; }
@Override public synchronized V put(K key, V value) { if (containsKey(key)) { backingMap.get(key).add(value); } else { List<V> list = Collections.synchronizedList(new CircularLinkedList<V>(maxValuesPerKeySize)); list.add(value); backingMap.put(key, list); } return value; }
public void record(String key, String value) { List<String> values = entries.get(key); if (values == null) { entries.putIfAbsent(key, Collections.synchronizedList(new ArrayList<String>())); // At this point, there will definitely be a list for the key. // We don't know or care which thread's new object is in there, so: values = entries.get(key); } values.add(value); }
public AsyncContext(List<T> inputs, Semaphore throttle, SettableFuture<List<T>> settableFuture) { this.inputs = inputs; this.latch = new AtomicInteger(inputs.size()); this.throttle = throttle; this.exceptions = Collections.synchronizedList(new ArrayList<Throwable>()); this.future = settableFuture; }
List list = Collections.synchronizedList(new ArrayList()); // Thread 1 List list2 = ... for (Object element : list2) { list.add(element); } // Thread 2 List list3 = ... for (Object element : list) { list3.add(element); }
/** * @param inputAcceptor * @param outputProducer */ public StepIOMeta( boolean inputAcceptor, boolean outputProducer, boolean inputOptional, boolean sortedDataRequired, boolean inputDynamic, boolean outputDynamic ) { this.inputAcceptor = inputAcceptor; this.outputProducer = outputProducer; this.inputOptional = inputOptional; this.sortedDataRequired = sortedDataRequired; this.streams = java.util.Collections.synchronizedList( new ArrayList<StreamInterface>() ); this.inputDynamic = inputDynamic; this.outputDynamic = outputDynamic; }
List<String> list = Collections.synchronizedList(new ArrayList<String>()); list.add("hello");
Collections.synchronizedList(new ArrayList<YourClassNameHere>())
public static List listDataFormats() { List list = new ArrayList(); Format[] formats = GridFormatFinder.getFormatArray(); final int length = formats.length; for (int i = 0; i < length; i++) { if (!list.contains(formats[i])) { list.add(formats[i]); } } return Collections.synchronizedList(list); }
public AggregatedBdbEnvironmentStats() { environmentStatsTracked = Collections.synchronizedList(new ArrayList<BdbEnvironmentStats>()); }
@Override public void registerListener(String switcherName, SwitcherListener listener) { synchronized (listenerMap) { if (listenerMap.get(switcherName) == null) { List listeners = Collections.synchronizedList(new ArrayList()); listenerMap.put(switcherName, listeners); listeners.add(listener); } else { List listeners = listenerMap.get(switcherName); if (!listeners.contains(listener)) { listeners.add(listener); } } } }
List<Object> objList = Collections.synchronizedList(new ArrayList<Object>());
@Override public synchronized NottableString put(NottableString key, NottableString value) { List<NottableString> list = Collections.synchronizedList(new ArrayList<NottableString>()); for (Entry<NottableString, NottableString> entry : entryList()) { if (EqualsBuilder.reflectionEquals(entry.getKey(), key)) { list.add(entry.getValue()); } } list.add(value); backingMap.put(key, list); return value; }
ColdTestPublisher() { this.values = Collections.synchronizedList(new ArrayList<>()); }