8158253: Collections: Implement a noop clear() for EmptyList, EmptyMap and EmptySet
Reviewed-by: psandoz
Contributed-by: Mohamed Naufal <naufal11@gmail.com>
--- a/jdk/src/java.base/share/classes/java/util/Collections.java Fri Jun 17 17:17:21 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/util/Collections.java Sat May 28 13:57:30 2016 +0530
@@ -4324,6 +4324,7 @@
public int size() {return 0;}
public boolean isEmpty() {return true;}
+ public void clear() {}
public boolean contains(Object obj) {return false;}
public boolean containsAll(Collection<?> c) { return c.isEmpty(); }
@@ -4447,6 +4448,7 @@
public int size() {return 0;}
public boolean isEmpty() {return true;}
+ public void clear() {}
public boolean contains(Object obj) {return false;}
public boolean containsAll(Collection<?> c) { return c.isEmpty(); }
@@ -4582,6 +4584,7 @@
public int size() {return 0;}
public boolean isEmpty() {return true;}
+ public void clear() {}
public boolean containsKey(Object key) {return false;}
public boolean containsValue(Object value) {return false;}
public V get(Object key) {return null;}