Uploaded image for project: 'ORC'
  1. ORC
  2. ORC-825

Use Empty Array For Collections toArray

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.8.0
    • 1.8.0
    • Java
    • None

    Description

      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().

      https://docs.oracle.com/javase/8/docs/api/java/util/Collection.html

      Recommended and faster to use the zero-size-array format

      Attachments

        Issue Links

          Activity

            People

              belugabehr David Mollitor
              belugabehr David Mollitor
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: