Create CollectToArray.java

Collects elements (primitive or complex types) into an array, where order is preserved and no deduplcation is performed