You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2019/10/22 06:37:00 UTC

[jira] [Work logged] (COLLECTIONS-704) GrowthList: ambiguity in constructor argument

     [ https://issues.apache.org/jira/browse/COLLECTIONS-704?focusedWorklogId=331828&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-331828 ]

ASF GitHub Bot logged work on COLLECTIONS-704:
----------------------------------------------

                Author: ASF GitHub Bot
            Created on: 22/Oct/19 06:36
            Start Date: 22/Oct/19 06:36
    Worklog Time Spent: 10m 
      Work Description: dota17 commented on pull request #90: [COLLECTIONS-704] Update size to capacity for GrowthList
URL: https://github.com/apache/commons-collections/pull/90
 
 
   [COLLECTIONS-704] Update the size to the capacity for GrowthList
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

            Worklog Id:     (was: 331828)
    Remaining Estimate: 0h
            Time Spent: 10m

> GrowthList: ambiguity in constructor argument
> ---------------------------------------------
>
>                 Key: COLLECTIONS-704
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-704
>             Project: Commons Collections
>          Issue Type: Improvement
>          Components: List
>    Affects Versions: 4.0, 4.2
>            Reporter: K P
>            Priority: Minor
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> The javadoc of constructor
> {{[GrowthList|https://commons.apache.org/proper/commons-collections/apidocs/org/apache/commons/collections4/list/GrowthList.html#GrowthList-int-](int initialSize)}}
> states:
> {{initialSize}} - the initial size of the ArrayList
>  
> However, this is confusing terminology: As the initialSize argument is passed directly to the internal ArrayList constructor, this is effectively the initial +capacity+. The +capacity+ is NOT the same as the actual list +size+. So after this constructor is called, the actual list.size() is still 0. This is identical to the normal ArrayList constructor's behavior of course.
> However, the GrowthList javadoc is confusing by explicitly claiming this is the "_initial size_", which may lead the reader to think that this constructor effectively grows the initial list to an actual given size - size in the sense the word is used everywhere else in the javadoc of this class. As opposed to the javadoc of Java's ArrayList, where they clear use the terminology "_the initial capacity of the list_", to avoid any confusion between the notion of internal array capacity and the list size.
> If, long ago, this GrowthList constructor was once intended to really set the ini**tial size, then is clearly not what the code does.
> However, if this never was the intention, and this was just intended to be an initial capacity, as the normal ArrayList, then the javadoc of GrowthList should be slightly reworded, to avoid ambiguity or misunderstanding, and make clear this is just the initial _capacity_ of the underlying ArrayList; not the initial _size_ of the list.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)