changeset 39059:a51b9d78b20c

8158253: Collections: Implement a noop clear() for EmptyList, EmptyMap and EmptySet Reviewed-by: psandoz Contributed-by: Mohamed Naufal <naufal11@gmail.com>
author psandoz
date Sat, 28 May 2016 13:57:30 +0530
parents b1ab5b47d979
children d39deb27f118
files jdk/src/java.base/share/classes/java/util/Collections.java
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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;}