You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@orc.apache.org by "William Hyun (Jira)" <ji...@apache.org> on 2022/09/03 22:44:00 UTC

[jira] [Closed] (ORC-825) Use Empty Array For Collections toArray

     [ https://issues.apache.org/jira/browse/ORC-825?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

William Hyun closed ORC-825.
----------------------------

> Use Empty Array For Collections toArray
> ---------------------------------------
>
>                 Key: ORC-825
>                 URL: https://issues.apache.org/jira/browse/ORC-825
>             Project: ORC
>          Issue Type: Improvement
>          Components: Java
>    Affects Versions: 1.8.0
>            Reporter: David Mollitor
>            Assignee: David Mollitor
>            Priority: Minor
>             Fix For: 1.8.0
>
>
> {quote}
> Suppose x is a collection known to contain only strings. The following code can be used to dump the collection into a newly allocated array of String:
>      String[] y = x.toArray(new String[0]);
> Note that toArray(new Object[0]) is identical in function to toArray().
> {quote}
> https://docs.oracle.com/javase/8/docs/api/java/util/Collection.html
> Recommended and faster to use the zero-size-array format



--
This message was sent by Atlassian Jira
(v8.20.10#820010)