-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
12.0.1
A DESCRIPTION OF THE PROBLEM :
The default constructor documentation of java.util.ArrayList class states actually "Constructs an empty list with an initial capacity of ten." where expected is "Constructs an empty list with an initial capacity of zero."
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1)
From download link (https://www.oracle.com/technetwork/java/javase/downloads/jdk12-downloads-5295953.html) download the latest jdk version 12 any operating system (for instance : jdk-12.0.1_windows-x64_bin.zip)
2)
Extract scr.zip
3)
Open ArrayList.java from ...src/java.base/java/uti/
4)
Goto default constructor of ArrayList and you will find that 'elementData' (the array bufffer into which the elements of the ArrayList are stored) is being initialized with 'DEFAULTCAPACITY_EMPTY_ELEMENTDATA' (which is Shared empty array instance used for default sized empty instances).
Which confirms that the default constructor of java.util.ArrayList class actually "Constructs an empty list with an initial capacity of zero BUT NOT ten.
Which should be corrected in documentation of default constructor of java.util.ArrayList.java
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The documentation of default constructor of java.util.ArrayList.java should state that "Constructs an empty list with an initial capacity of zero." BUT NOT ten.
ACTUAL -
The documentation of default constructor of java.util.ArrayList.java actually states that "Constructs an empty list with an initial capacity of ten."
FREQUENCY : always
The default constructor documentation of java.util.ArrayList class states actually "Constructs an empty list with an initial capacity of ten." where expected is "Constructs an empty list with an initial capacity of zero."
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1)
From download link (https://www.oracle.com/technetwork/java/javase/downloads/jdk12-downloads-5295953.html) download the latest jdk version 12 any operating system (for instance : jdk-12.0.1_windows-x64_bin.zip)
2)
Extract scr.zip
3)
Open ArrayList.java from ...src/java.base/java/uti/
4)
Goto default constructor of ArrayList and you will find that 'elementData' (the array bufffer into which the elements of the ArrayList are stored) is being initialized with 'DEFAULTCAPACITY_EMPTY_ELEMENTDATA' (which is Shared empty array instance used for default sized empty instances).
Which confirms that the default constructor of java.util.ArrayList class actually "Constructs an empty list with an initial capacity of zero BUT NOT ten.
Which should be corrected in documentation of default constructor of java.util.ArrayList.java
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The documentation of default constructor of java.util.ArrayList.java should state that "Constructs an empty list with an initial capacity of zero." BUT NOT ten.
ACTUAL -
The documentation of default constructor of java.util.ArrayList.java actually states that "Constructs an empty list with an initial capacity of ten."
FREQUENCY : always
- duplicates
-
JDK-8143020 no-arg ArrayList constructor specification has confusing wording about capacity
-
- Open
-