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

How to use
synchronizedCollection
method
in
java.util.Collections

Best Java code snippets using java.util.Collections.synchronizedCollection (Showing top 20 results out of 648)

origin: org.codehaus.groovy/groovy

/**
 * A convenience method for creating a synchronized Collection.
 *
 * @param self a Collection
 * @return a synchronized Collection
 * @see java.util.Collections#synchronizedCollection(java.util.Collection)
 * @since 1.0
 */
public static <T> Collection<T> asSynchronized(Collection<T> self) {
  return Collections.synchronizedCollection(self);
}
origin: org.netbeans.api/org-openide-util-lookup

/** Marks this item as being deserialized.
 */
public void markDeserialized() {
  if (items == null || items == Collections.EMPTY_LIST) {
    items = Collections.emptyList();
  } else {
    items = Collections.synchronizedCollection(items);
  }
}
origin: apache/incubator-gobblin

private Dataset(Builder builder) {
 this.inputPaths = builder.inputPaths;
 this.inputLatePaths = builder.inputLatePaths;
 this.outputPath = builder.outputPath;
 this.outputLatePath = builder.outputLatePath;
 this.outputTmpPath = builder.outputTmpPath;
 this.additionalInputPaths = Sets.newHashSet();
 this.throwables = Collections.synchronizedCollection(Lists.<Throwable> newArrayList());
 this.priority = builder.priority;
 this.lateDataThresholdForRecompact = builder.lateDataThresholdForRecompact;
 this.state = new AtomicReference<>(DatasetState.UNVERIFIED);
 this.datasetName = builder.datasetName;
 this.jobProps = builder.jobProps;
 this.renamePaths = builder.renamePaths;
}
origin: wildfly/wildfly

public Collection<V> values() {
  synchronized(mutex) {
    if(values == null)
      values=Collections.synchronizedCollection(map.values());
    return values;
  }
}
origin: wildfly/wildfly

classes.add(Collections.checkedSortedSet(Collections.emptySortedSet(), Void.class).getClass());
classes.add(Collections.synchronizedCollection(randomAccessList).getClass());
classes.add(Collections.synchronizedCollection(nonRandomAccessList).getClass());
classes.add(Collections.synchronizedList(randomAccessList).getClass());
classes.add(Collections.synchronizedList(nonRandomAccessList).getClass());
origin: protostuff/protostuff

.synchronizedCollection(Collections.emptyList()); // no
origin: banq/jdonframework

public Collection<String> getComponentNames() {
  return Collections.synchronizedCollection(dirs.values());
}
origin: didi/DDMQ

public static Collection<Object> getFilterdMessage(Collection<Object> sendMsgs,
  Collection<Object> recvMsgs) {
  Collection<Object> recvMsgsSync = Collections.synchronizedCollection(recvMsgs);
  Collection<Object> filterdMsgs = new ArrayList<Object>();
  int filterNum = 0;
  for (Object msg : recvMsgsSync) {
    if (sendMsgs.contains(msg)) {
      filterdMsgs.add(msg);
    } else {
      filterNum++;
    }
  }
  logger.info(String.format("[%s] messages is filterd!", filterNum));
  return filterdMsgs;
}
origin: apache/metron

futures.add(pool.submit(() -> {
 KafkaProducer<String, String> producer = kafkaProducer.get();
 Collection<Future<?>> b = Collections.synchronizedCollection(new ArrayList<>());
 for (int i = 0; i < batchSize; ++i) {
  b.add(sendToKafka(producer, kafkaTopic, messageSupplier.get()));
origin: didi/DDMQ

for (AbstractListener listener : listeners) {
  Collection<Object> recvMsgs = Collections
    .synchronizedCollection(listener.getAllUndupMsgBody());
  noDupMsgs.addAll(VerifyUtils.getFilterdMessage(allSendMsgs, recvMsgs));
origin: de.javakaffee/kryo-serializers

  @Override
  public Object create( final Object sourceCollection ) {
    return Collections.synchronizedCollection( (Collection<?>) sourceCollection );
  }
},
origin: org.kohsuke.droovy/groovy

/**
 * A convenience method for creating a synchronized Collection.
 *
 * @param self a Collection
 * @return a synchronized Collection
 * @see java.util.Collections#synchronizedCollection(java.util.Collection)
 * @since 1.0
 */
public static Collection asSynchronized(Collection self) {
  return Collections.synchronizedCollection(self);
}
origin: in.jlibs/org-openide-util

/** Marks this item as being deserialized.
 */
public void markDeserialized() {
  if (items == null || items == Collections.EMPTY_LIST) {
    items = Collections.emptyList();
  } else {
    items = Collections.synchronizedCollection(items);
  }
}
origin: stackoverflow.com

Collection c = Collections.synchronizedCollection(myCollection);
  ...
synchronized(c) {
  Iterator i = c.iterator(); // Must be in the synchronized block
  while (i.hasNext())
    foo(i.next());
}
origin: apache/activemq-artemis

public Collection<V> values() {
  synchronized(mutex) {
    if(values == null)
      values=Collections.synchronizedCollection(map.values());
    return values;
  }
}
origin: apache/activemq-artemis

public Collection<V> values() {
  synchronized(mutex) {
    if(values == null)
      values=Collections.synchronizedCollection(map.values());
    return values;
  }
}
origin: org.apache.activemq/artemis-jms-client-all

public Collection<V> values() {
  synchronized(mutex) {
    if(values == null)
      values=Collections.synchronizedCollection(map.values());
    return values;
  }
}
origin: com.mchange/mchange-commons-java

public static Collection narrowSynchronizedCollection( Collection c )
{
if (c instanceof SortedSet)
  return Collections.synchronizedSortedSet( (SortedSet) c );
else if (c instanceof Set)
  return Collections.synchronizedSet( (Set) c );
else if (c instanceof List)
  return Collections.synchronizedList( (List) c );
else
  return Collections.synchronizedCollection( c );
}
origin: org.jboss.eap/wildfly-client-all

public Collection<V> values() {
  synchronized(mutex) {
    if(values == null)
      values=Collections.synchronizedCollection(map.values());
    return values;
  }
}
origin: org.apache.commons/com.springsource.org.apache.commons.vfs

/**
 * 
 */
void clear()
{
  this.buffer = new byte[0];
  updateLastModified();
  this.type = FileType.IMAGINARY;
  this.children = Collections.synchronizedCollection(new ArrayList());
  this.name = null;
}
java.utilCollectionssynchronizedCollection

Javadoc

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

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,
  • synchronizedList,
  • 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