-
Enhancement
-
Resolution: Duplicate
-
P4
-
None
-
9
-
generic
-
generic
A DESCRIPTION OF THE REQUEST :
To add an array to a Collection we can use Collections.addAll(Collection<? super T> c, T... elements). It should be possible to add an array of elements directly to a collection.
JUSTIFICATION :
This extension improves the readability and clearity of code.
addAll(collection,array)
vs
collection.addAll(array)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Collection.add(T ...elements) should behave exactly as Collections.addAll(Collection<? super T> c, T... elements).
---------- BEGIN SOURCE ----------
Collection<String> c = new ArrayList<String>();
c.addAll( "a","b","c" );
assertThat(c).containsExactly("a","b","c");
---------- END SOURCE ----------
To add an array to a Collection we can use Collections.addAll(Collection<? super T> c, T... elements). It should be possible to add an array of elements directly to a collection.
JUSTIFICATION :
This extension improves the readability and clearity of code.
addAll(collection,array)
vs
collection.addAll(array)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Collection.add(T ...elements) should behave exactly as Collections.addAll(Collection<? super T> c, T... elements).
---------- BEGIN SOURCE ----------
Collection<String> c = new ArrayList<String>();
c.addAll( "a","b","c" );
assertThat(c).containsExactly("a","b","c");
---------- END SOURCE ----------
- duplicates
-
JDK-8135001 Enhance Collection.addAll(Collection<? extends E> c) to accept varargs
-
- Closed
-
- relates to
-
JDK-8135001 Enhance Collection.addAll(Collection<? extends E> c) to accept varargs
-
- Closed
-