@Override public List<E> subList(int start, int end) { synchronized (mutex) { return new SynchronizedList<E>(list.subList(start, end), mutex); } }
/** * 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); }
@Override public List<E> subList(int start, int end) { synchronized (mutex) { return new SynchronizedList<E>(list.subList(start, end), mutex); } }
/** * 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); } }
/** * 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); } }
/** * 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); } }
/** * 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); } }
static <T> List<T> synchronizedList(List<T> list, Object mutex) { return (list instanceof RandomAccess ? new SynchronizedRandomAccessList<>(list, mutex) : new SynchronizedList<>(list, mutex)); }
/** * 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); } }
@Override public List<E> subList(int start, int end) { synchronized (mutex) { return new SynchronizedList<E>(list.subList(start, end), mutex); } }
static <T> List<T> synchronizedList(List<T> list, Object mutex) { return (list instanceof RandomAccess ? new SynchronizedRandomAccessList<>(list, mutex) : new SynchronizedList<>(list, mutex)); }
@Override public List<E> subList(int start, int end) { synchronized (mutex) { return new SynchronizedList<E>(list.subList(start, end), mutex); } }
public List<E> subList(int fromIndex, int toIndex) { synchronized (mutex) { return new SynchronizedList<>(list.subList(fromIndex, toIndex), mutex); } }
@Override public List<E> subList(int start, int end) { synchronized (mutex) { return new SynchronizedList<E>(list.subList(start, end), mutex); } }
@Override public List<E> subList(int start, int end) { synchronized (mutex) { return new SynchronizedList<E>(list.subList(start, end), mutex); } }
/** * 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); } }
@Override public List<E> subList(int start, int end) { synchronized (mutex) { return new SynchronizedList<E>(list.subList(start, end), mutex); } }
public List<E> subList(int fromIndex, int toIndex) { synchronized (mutex) { return new SynchronizedList<>(list.subList(fromIndex, toIndex), mutex); } }
@Override public List<E> subList(int start, int end) { synchronized (mutex) { return new SynchronizedList<E>(list.subList(start, end), mutex); } }
/** * 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); } }