Trying to create an Object array, but get "cannot create a generic array of Object".
I tried to cast it with (Object[]), but it didn't help.
public class Container<Object> {
Object start;
Container(Object start){
this.start=start;
}
LinkedList<Object> save = new LinkedList<>();
public Object[] toArray() {
Object[] test = (Object[]) new Object [3]; // cannot create here
for (int i=0; i<save.size(); i++)
{
...
}
}