8158253: Collections: Implement a noop clear() for EmptyList, EmptyMap and EmptySet
authorpsandoz
Sat, 28 May 2016 13:57:30 +0530
changeset 39059 a51b9d78b20c
parent 39058 b1ab5b47d979
child 39060 d39deb27f118
8158253: Collections: Implement a noop clear() for EmptyList, EmptyMap and EmptySet Reviewed-by: psandoz Contributed-by: Mohamed Naufal <naufal11@gmail.com>
jdk/src/java.base/share/classes/java/util/Collections.java
--- 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;}