I have a question about how to make a partition of an Object List. What I want is that I have a List with 1000 objects and I want to create a sublist to have 500 objects on one side and another 500 on the other.
I have an object class called orders and I have created an order ArrayList with 1000 order objects.
What I want to get is to put those two List in a new arrayList to be able to pass it by parameter. I need it to be that way since when calling the method it is not possible to work. (I could send my Order ArrayList and take what I I would need but the method needs it to be List).
It's what I've come up with to be able to work separately on the data, but if there was another option that I do not fall right now, I could apply it to just send one part and then the other to the method.
// the only way to partition and then pass the two List of objects would be like this, but I do not know how to put it in a List to be called or if there is another way.
List<pedidos> pedido1 = pedidos.subList(0, 500); List<pedidos> pedido1 = pedidos.subList(500, 100);