java - Add Collection (ArrayList) to ConcurrentQueue -
i have piece of code builds arraylist of custom class type ouput of function. then, attempt addall(collection) arraylist concurrentlinkeddeque. seems happen concurrentlinkeddeque ends containing arraylist.size() of last element in arraylist.
i have done various checks see if arraylist built , including proper elements, not seem see through problem. there peculiarities adding collections concurrentlinkeddeque's?
can try this
public class concurrentldtrial{ public static void main(string[] args) { list<integer> = new arraylist<integer>(); a.add(2); a.add(3); concurrentlinkeddeque<integer> cd = new concurrentlinkeddeque<integer>(a); system.out.println(cd); } }
the output [2, 3] , expected.
cast data structures appropriately custom class.
Comments
Post a Comment