Tabnine Logo
Collections$SynchronizedList
Code IndexAdd Tabnine to your IDE (free)

How to use
Collections$SynchronizedList
in
java.util

Best Java code snippets using java.util.Collections$SynchronizedList (Showing top 20 results out of 315)

origin: robovm/robovm

/**
 * Returns a wrapper on the specified List which synchronizes all access to
 * the List.
 *
 * @param list
 *            the List to wrap in a synchronized list.
 * @return a synchronized List.
 */
public static <T> List<T> synchronizedList(List<T> list) {
  if (list == null) {
    throw new NullPointerException("list == null");
  }
  if (list instanceof RandomAccess) {
    return new SynchronizedRandomAccessList<T>(list);
  }
  return new SynchronizedList<T>(list);
}
origin: jtulach/bck2brwsr

/**
 * Returns a synchronized (thread-safe) list backed by the specified
 * list.  In order to guarantee serial access, it is critical that
 * <strong>all</strong> access to the backing list is accomplished
 * through the returned list.<p>
 *
 * It is imperative that the user manually synchronize on the returned
 * list when iterating over it:
 * <pre>
 *  List list = Collections.synchronizedList(new ArrayList());
 *      ...
 *  synchronized (list) {
 *      Iterator i = list.iterator(); // Must be in synchronized block
 *      while (i.hasNext())
 *          foo(i.next());
 *  }
 * </pre>
 * Failure to follow this advice may result in non-deterministic behavior.
 *
 * <p>The returned list will be serializable if the specified list is
 * serializable.
 *
 * @param  list the list to be "wrapped" in a synchronized list.
 * @return a synchronized view of the specified list.
 */
public static <T> List<T> synchronizedList(List<T> list) {
  return (list instanceof RandomAccess ?
      new SynchronizedRandomAccessList<>(list) :
      new SynchronizedList<>(list));
}
origin: org.apidesign.bck2brwsr/emul

/**
 * Returns a synchronized (thread-safe) list backed by the specified
 * list.  In order to guarantee serial access, it is critical that
 * <strong>all</strong> access to the backing list is accomplished
 * through the returned list.<p>
 *
 * It is imperative that the user manually synchronize on the returned
 * list when iterating over it:
 * <pre>
 *  List list = Collections.synchronizedList(new ArrayList());
 *      ...
 *  synchronized (list) {
 *      Iterator i = list.iterator(); // Must be in synchronized block
 *      while (i.hasNext())
 *          foo(i.next());
 *  }
 * </pre>
 * Failure to follow this advice may result in non-deterministic behavior.
 *
 * <p>The returned list will be serializable if the specified list is
 * serializable.
 *
 * @param  list the list to be "wrapped" in a synchronized list.
 * @return a synchronized view of the specified list.
 */
public static <T> List<T> synchronizedList(List<T> list) {
  return (list instanceof RandomAccess ?
      new SynchronizedRandomAccessList<>(list) :
      new SynchronizedList<>(list));
}
origin: com.gluonhq/robovm-rt

/**
 * Returns a wrapper on the specified List which synchronizes all access to
 * the List.
 *
 * @param list
 *            the List to wrap in a synchronized list.
 * @return a synchronized List.
 */
public static <T> List<T> synchronizedList(List<T> list) {
  if (list == null) {
    throw new NullPointerException("list == null");
  }
  if (list instanceof RandomAccess) {
    return new SynchronizedRandomAccessList<T>(list);
  }
  return new SynchronizedList<T>(list);
}
origin: com.jtransc/jtransc-rt

/**
 * Returns a wrapper on the specified List which synchronizes all access to
 * the List.
 *
 * @param list
 *            the List to wrap in a synchronized list.
 * @return a synchronized List.
 */
public static <T> List<T> synchronizedList(List<T> list) {
  if (list == null) {
    throw new NullPointerException("list == null");
  }
  if (list instanceof RandomAccess) {
    return new SynchronizedRandomAccessList<T>(list);
  }
  return new SynchronizedList<T>(list);
}
origin: FlexoVM/flexovm

/**
 * Returns a wrapper on the specified List which synchronizes all access to
 * the List.
 *
 * @param list
 *            the List to wrap in a synchronized list.
 * @return a synchronized List.
 */
public static <T> List<T> synchronizedList(List<T> list) {
  if (list == null) {
    throw new NullPointerException("list == null");
  }
  if (list instanceof RandomAccess) {
    return new SynchronizedRandomAccessList<T>(list);
  }
  return new SynchronizedList<T>(list);
}
origin: ibinti/bugvm

/**
 * Returns a wrapper on the specified List which synchronizes all access to
 * the List.
 *
 * @param list
 *            the List to wrap in a synchronized list.
 * @return a synchronized List.
 */
public static <T> List<T> synchronizedList(List<T> list) {
  if (list == null) {
    throw new NullPointerException("list == null");
  }
  if (list instanceof RandomAccess) {
    return new SynchronizedRandomAccessList<T>(list);
  }
  return new SynchronizedList<T>(list);
}
origin: com.bugvm/bugvm-rt

/**
 * Returns a wrapper on the specified List which synchronizes all access to
 * the List.
 *
 * @param list
 *            the List to wrap in a synchronized list.
 * @return a synchronized List.
 */
public static <T> List<T> synchronizedList(List<T> list) {
  if (list == null) {
    throw new NullPointerException("list == null");
  }
  if (list instanceof RandomAccess) {
    return new SynchronizedRandomAccessList<T>(list);
  }
  return new SynchronizedList<T>(list);
}
origin: MobiVM/robovm

/**
 * Returns a wrapper on the specified List which synchronizes all access to
 * the List.
 *
 * @param list
 *            the List to wrap in a synchronized list.
 * @return a synchronized List.
 */
public static <T> List<T> synchronizedList(List<T> list) {
  if (list == null) {
    throw new NullPointerException("list == null");
  }
  if (list instanceof RandomAccess) {
    return new SynchronizedRandomAccessList<T>(list);
  }
  return new SynchronizedList<T>(list);
}
origin: com.gluonhq/robovm-rt

  /**
   * Replaces this SynchronizedRandomAccessList with a SynchronizedList so
   * that JREs before 1.4 can deserialize this object without any
   * problems. This is necessary since RandomAccess API was introduced
   * only in 1.4.
   * <p>
   *
   * @return SynchronizedList
   *
   * @see SynchronizedList#readResolve()
   */
  private Object writeReplace() {
    return new SynchronizedList<E>(list);
  }
}
origin: FlexoVM/flexovm

  /**
   * Replaces this SynchronizedRandomAccessList with a SynchronizedList so
   * that JREs before 1.4 can deserialize this object without any
   * problems. This is necessary since RandomAccess API was introduced
   * only in 1.4.
   * <p>
   *
   * @return SynchronizedList
   *
   * @see SynchronizedList#readResolve()
   */
  private Object writeReplace() {
    return new SynchronizedList<E>(list);
  }
}
origin: com.bugvm/bugvm-rt

  /**
   * Replaces this SynchronizedRandomAccessList with a SynchronizedList so
   * that JREs before 1.4 can deserialize this object without any
   * problems. This is necessary since RandomAccess API was introduced
   * only in 1.4.
   * <p>
   *
   * @return SynchronizedList
   *
   * @see SynchronizedList#readResolve()
   */
  private Object writeReplace() {
    return new SynchronizedList<E>(list);
  }
}
origin: com.mobidevelop.robovm/robovm-rt

/**
 * Returns a wrapper on the specified List which synchronizes all access to
 * the List.
 *
 * @param list
 *            the List to wrap in a synchronized list.
 * @return a synchronized List.
 */
public static <T> List<T> synchronizedList(List<T> list) {
  if (list == null) {
    throw new NullPointerException("list == null");
  }
  if (list instanceof RandomAccess) {
    return new SynchronizedRandomAccessList<T>(list);
  }
  return new SynchronizedList<T>(list);
}
origin: com.mobidevelop.robovm/robovm-rt

  /**
   * Replaces this SynchronizedRandomAccessList with a SynchronizedList so
   * that JREs before 1.4 can deserialize this object without any
   * problems. This is necessary since RandomAccess API was introduced
   * only in 1.4.
   * <p>
   *
   * @return SynchronizedList
   *
   * @see SynchronizedList#readResolve()
   */
  private Object writeReplace() {
    return new SynchronizedList<E>(list);
  }
}
origin: com.jtransc/jtransc-rt

  /**
   * Replaces this SynchronizedRandomAccessList with a SynchronizedList so
   * that JREs before 1.4 can deserialize this object without any
   * problems. This is necessary since RandomAccess API was introduced
   * only in 1.4.
   * <p>
   *
   * @return SynchronizedList
   *
   * @see SynchronizedList#readResolve()
   */
  private Object writeReplace() {
    return new SynchronizedList<E>(list);
  }
}
origin: ibinti/bugvm

  /**
   * Replaces this SynchronizedRandomAccessList with a SynchronizedList so
   * that JREs before 1.4 can deserialize this object without any
   * problems. This is necessary since RandomAccess API was introduced
   * only in 1.4.
   * <p>
   *
   * @return SynchronizedList
   *
   * @see SynchronizedList#readResolve()
   */
  private Object writeReplace() {
    return new SynchronizedList<E>(list);
  }
}
origin: jtulach/bck2brwsr

  /**
   * Allows instances to be deserialized in pre-1.4 JREs (which do
   * not have SynchronizedRandomAccessList).  SynchronizedList has
   * a readResolve method that inverts this transformation upon
   * deserialization.
   */
  private Object writeReplace() {
    return new SynchronizedList<>(list);
  }
}
origin: jtulach/bck2brwsr

static <T> List<T> synchronizedList(List<T> list, Object mutex) {
  return (list instanceof RandomAccess ?
      new SynchronizedRandomAccessList<>(list, mutex) :
      new SynchronizedList<>(list, mutex));
}
origin: MobiVM/robovm

  /**
   * Replaces this SynchronizedRandomAccessList with a SynchronizedList so
   * that JREs before 1.4 can deserialize this object without any
   * problems. This is necessary since RandomAccess API was introduced
   * only in 1.4.
   * <p>
   *
   * @return SynchronizedList
   *
   * @see SynchronizedList#readResolve()
   */
  private Object writeReplace() {
    return new SynchronizedList<E>(list);
  }
}
origin: com.jtransc/jtransc-rt

@Override public List<E> subList(int start, int end) {
  synchronized (mutex) {
    return new SynchronizedList<E>(list.subList(start, end), mutex);
  }
}
java.utilCollections$SynchronizedList

Most used methods

  • <init>

Popular in Java

  • Start an intent from android
  • scheduleAtFixedRate (Timer)
  • findViewById (Activity)
  • getSharedPreferences (Context)
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • JCheckBox (javax.swing)
  • Top 12 Jupyter Notebook extensions
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