I have Class Customers and this class have attribute name : Customer_id this Customer_id is Random by this code :
int USER_RANDOM_ID = rand.nextInt(2000) + 1;
Note : I stored all object in ArrayList and I need to push all Objects to Queues.
My question is how can I sort objects like this: customer with lowest id will be served first.
This is my code to Send Objects from List to Queue. Here I want to sort object dependent id number.
AmmanQueue = new QueueImplementation();
for(int i =0; i<MainActivity.Amman.getLength(); i++)
{
AmmanQueue.enqueue(MainActivity.Amman.getEntry(i));
}