src/share/classes/java/util/Collections.java
Print this page
rev 6197 : [mq]: collections
@@ -26,10 +26,13 @@
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,10 +1108,13 @@
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,10 +1241,16 @@
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,10 +1688,16 @@
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,10 +1932,16 @@
}
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
}