src/share/classes/java/util/Collections.java

Print this page
rev 6197 : [mq]: collections

*** 26,35 **** --- 26,38 ---- package java.util; import java.io.Serializable; import java.io.ObjectOutputStream; import java.io.IOException; import java.lang.reflect.Array; + import java.util.function.Block; + import java.util.function.Predicate; + import java.util.function.UnaryOperator; /** * This class consists exclusively of static methods that operate on or return * collections. It contains polymorphic algorithms that operate on * collections, "wrappers", which return a new collection backed by a
*** 1105,1114 **** --- 1108,1120 ---- throw new UnsupportedOperationException(); } public void clear() { throw new UnsupportedOperationException(); } + public boolean removeAll(Predicate<? super E> filter) { + throw new UnsupportedOperationException(); + } } /** * Returns an unmodifiable view of the specified set. This method allows * modules to provide users with "read-only" access to internal sets.
*** 1235,1244 **** --- 1241,1256 ---- public int indexOf(Object o) {return list.indexOf(o);} public int lastIndexOf(Object o) {return list.lastIndexOf(o);} public boolean addAll(int index, Collection<? extends E> c) { throw new UnsupportedOperationException(); } + public void replaceAll(UnaryOperator<E> operator) { + throw new UnsupportedOperationException(); + } + public void sort(Comparator<? super E> c) { + throw new UnsupportedOperationException(); + } public ListIterator<E> listIterator() {return listIterator(0);} public ListIterator<E> listIterator(final int index) { return new ListIterator<E>() { private final ListIterator<? extends E> i
*** 1676,1685 **** --- 1688,1703 ---- synchronized (mutex) {return c.toString();} } private void writeObject(ObjectOutputStream s) throws IOException { synchronized (mutex) {s.defaultWriteObject();} } + public void forEach(Block<? super E> block) { + synchronized (mutex) {c.forEach(block);} + } + public boolean removeAll(Predicate<? super E> filter) { + synchronized (mutex) {return c.removeAll(filter);} + } } /** * Returns a synchronized (thread-safe) set backed by the specified * set. In order to guarantee serial access, it is critical that
*** 1914,1923 **** --- 1932,1947 ---- } public boolean addAll(int index, Collection<? extends E> c) { synchronized (mutex) {return list.addAll(index, c);} } + public void replaceAll(UnaryOperator<E> operator) { + synchronized (mutex) {list.replaceAll(operator);} + } + public void sort(Comparator<? super E> c) { + synchronized (mutex) {list.sort(c);} + } public ListIterator<E> listIterator() { return list.listIterator(); // Must be manually synched by user }