[ 
https://issues.apache.org/jira/browse/HBASE-18573?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16125119#comment-16125119
 ] 

Xiang Li commented on HBASE-18573:
----------------------------------

Hi [~stack], sorry to disturb you. I might not be able to read Jan, for 
HBASE-10699. Do you have any idea for the following items?
* Any special reason to set initial capacity when allocating ArrayList? Is it 
safe than new ArrayList<>()?
* Why initial capacity is set to 1, rather than other number?
* Why it is done for Append and Delete, but not for Put and Increment?

I am trying to make it unified to use Mutation#getCellList(family) in addxxx 
functions of all sub-classes of Mutation. But in Append and Delete, the code 
allocates ArrayList with initial capacity to 1, while Increment and Put calls 
Mutation#getCellList(family) and ArrayList is allocated with no initial 
capacity specified. I am just trying to figure out if there is any special 
consideration for Jan to set  initial capacity for Append and Delete when back 
to HBASE-10699.

> Update Append and Delete to use Mutation#getCellList(family)
> ------------------------------------------------------------
>
>                 Key: HBASE-18573
>                 URL: https://issues.apache.org/jira/browse/HBASE-18573
>             Project: HBase
>          Issue Type: Improvement
>            Reporter: Xiang Li
>            Assignee: Xiang Li
>            Priority: Minor
>
> In addxxx() of Put and Increment, Mutation#getCellList(family) is called to 
> get cell list from familyMap. But in the other 2 sub-class of Mutation: 
> Append and Delete, the logic like Mutation#getCellList(family) is used, like
> {code}
>     List<Cell> list = familyMap.get(family);
>     if(list == null) {
>       list = new ArrayList<>(1);
>     }
> {code}
> in
> {code}
> public Delete addColumn(byte [] family, byte [] qualifier, long timestamp)
> {code}
> of Delete
> We could make them to call Mutation#getCellList(family) to get better 
> encapsulation



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to