cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aleksey Yeschenko (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CASSANDRA-14367) prefer Collections.singletonList to Arrays.asList(one_element)
Date Fri, 06 Apr 2018 18:37:00 GMT

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

Aleksey Yeschenko edited comment on CASSANDRA-14367 at 4/6/18 6:36 PM:
-----------------------------------------------------------------------

And sometimes we mutate those arguments, which you cannot do with the immutable {{singletonList()}}
for example. Not saying it’s the case with any of this substitutions - just please be very
careful with these changes.


was (Author: iamaleksey):
And sometimes we mutate those arguments, which you cannot do with the immutable {{SingletonList}}
for example. Not saying it’s the case with any of this substitutions - just please be very
careful with these changes.

> prefer Collections.singletonList to Arrays.asList(one_element)
> --------------------------------------------------------------
>
>                 Key: CASSANDRA-14367
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-14367
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Dave Brosius
>            Assignee: Dave Brosius
>            Priority: Trivial
>             Fix For: 4.x
>
>         Attachments: 14367.txt
>
>
> small improvement, but Arrays.asList first creates an array, then wraps it with a collections
instance, whereas Collections.singletonList just creates one small (one field) bean instance.
> so a small cut down on garbage generated.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org


Mime
View raw message