I am trying to do copy from a LinkedBlockingQueue to a dataStuff[] data array using .toArray() but I am getting an Exception
Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [LdataStuff;
at Main.main(Main.java:30)
with the following code
public static BlockingQueue<dataStuff> recurseFragments = new LinkedBlockingQueue<dataStuff>();
public static void main(String args[]) throws IOException
{
dataStuff[] data = (dataStuff[]) recurseFragments.toArray();
}
I understand that its putting the recurseFragments into an object[] before it spits it into the array but why is it that casting does not work and how can I solve this?