Tabnine Logo
Collections.synchronizedList
Code IndexAdd Tabnine to your IDE (free)

How to use
synchronizedList
method
in
java.util.Collections

Best Java code snippets using java.util.Collections.synchronizedList (Showing top 20 results out of 7,308)

Refine searchRefine arrow

  • ArrayList.<init>
  • List.add
origin: junit-team/junit4

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();
}
origin: weibocom/motan

@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);
  }
}
origin: gocd/gocd

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));
}
origin: Rajawali/Rajawali

/**
 * 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));
}
origin: Bilibili/DanmakuFlameMaster

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));
}
origin: weibocom/motan

/**
 * 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;
}
origin: androidannotations/androidannotations

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;
}
origin: jamesdbloom/mockserver

@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;
}
origin: stackoverflow.com

 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);
}
origin: apache/storm

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;
}
origin: stackoverflow.com

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);
 }
origin: pentaho/pentaho-kettle

/**
 * @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;
}
origin: stackoverflow.com

 List<String> list = Collections.synchronizedList(new ArrayList<String>());
list.add("hello");
origin: stackoverflow.com

Collections.synchronizedList(new ArrayList<YourClassNameHere>())
origin: geoserver/geoserver

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);
}
origin: voldemort/voldemort

public AggregatedBdbEnvironmentStats() {
  environmentStatsTracked = Collections.synchronizedList(new ArrayList<BdbEnvironmentStats>());
}
origin: networknt/light-4j

@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);
      }
    }
  }
}
origin: stackoverflow.com

List<Object> objList = Collections.synchronizedList(new ArrayList<Object>());
origin: jamesdbloom/mockserver

@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;
}
origin: reactor/reactor-core

ColdTestPublisher() {
  this.values = Collections.synchronizedList(new ArrayList<>());
}
java.utilCollectionssynchronizedList

Javadoc

Returns a wrapper on the specified List which synchronizes all access to the List.

Popular methods of Collections

  • emptyList
    Returns the empty list (immutable). This list is serializable.This example illustrates the type-safe
  • sort
  • singletonList
    Returns an immutable list containing only the specified object. The returned list is serializable.
  • unmodifiableList
    Returns an unmodifiable view of the specified list. This method allows modules to provide users with
  • emptyMap
    Returns the empty map (immutable). This map is serializable.This example illustrates the type-safe w
  • emptySet
    Returns the empty set (immutable). This set is serializable. Unlike the like-named field, this metho
  • unmodifiableMap
    Returns an unmodifiable view of the specified map. This method allows modules to provide users with
  • singleton
    Returns an immutable set containing only the specified object. The returned set is serializable.
  • unmodifiableSet
    Returns an unmodifiable view of the specified set. This method allows modules to provide users with
  • singletonMap
    Returns an immutable map, mapping only the specified key to the specified value. The returned map is
  • addAll
    Adds all of the specified elements to the specified collection. Elements to be added may be specifie
  • reverse
    Reverses the order of the elements in the specified list. This method runs in linear time.
  • addAll,
  • reverse,
  • unmodifiableCollection,
  • shuffle,
  • enumeration,
  • list,
  • synchronizedMap,
  • reverseOrder,
  • emptyIterator

Popular in Java

  • Making http requests using okhttp
  • scheduleAtFixedRate (ScheduledExecutorService)
  • onCreateOptionsMenu (Activity)
  • getExternalFilesDir (Context)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now