I'm calling a method in another API that accepts a java.util.Collection
of objects. I've looked at the method and it immediately copies everything in the collection into a new ArrayList
before performing its task.
This got me wondering: What is the absolute lowest overhead Java Collection that I can use to quickly assemble parameters for this method?
That depends on how it copies the elements, but if it creates the
ArrayList
-copy like thisor if it does
then the it will go through the
inputCollection.toArray()
which is probably best implemented byArrayList
.