Creating a generic array in Java

Generic array initialization

Recently I work with CompletableFutures. I used the allOf method which
takes a varargs as input. Based on the request, a couple of things had to be processed.

So how do I create a generic array that I could use at CompletableFuture.allof()?
Array.newInstance together with toArray() does the trick.

This is my solution:

https://gist.github.com/claudioaltamura/dac3f56e41a77a052c59539cc06fb52e

Consent Management Platform von Real Cookie Banner