GitHub user otaviojava opened a pull request:
https://github.com/apache/tinkerpop/pull/920
optmizes collection copy with Collections addAll
Copying of array contents to a collection where each element is added
individually using a for a loop. We can be replaced by a call to
Collections.addAll().
As the documentation says:
> Adds all of the specified elements to the specified collection. Elements
to be added may be specified individually or as an array. The behavior of this
convenience method is identical to that of c.addAll(Arrays.asList(elements)),
but this method is likely to run significantly faster under most
implementations.
When elements are specified individually, this method provides a convenient
way to add a few elements to an existing collection:
https://docs.oracle.com/javase/8/docs/api/java/util/Collections.html#addAll-java.util.Collection-T...-
In my experience using either Collections.addll or Collections.addAll used
to be 30% faster then add from loop.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/otaviojava/tinkerpop
optmizes_collections_copy_tp32
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/tinkerpop/pull/920.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #920
commit 0e34073d8a756a52eda571bd9ddac0b94b42d54a
Author: Otavio Santana
Date: 2018-08-22T19:45:19Z
optmizes collection copy with Collections addAll
---