getElements

The array you provide to contain the collection's elements must be
large enough to contain them. Accordingly, you should synchronize on this
collection, invoke ReadableSet.size(), create an array of the required size,
and then invoke this method. This ensures that the collection's size
won't change by the time you get to actually retrieving its elements.

This method also completely erases the current contents of your
object array out-parameter.

Parameters:

elements - Object array to contain returned elements; must be large
enough to retrieve the collection's elements.