0
我有类客户和这个类有属性名称:CUSTOMER_ID 这CUSTOMER_ID是此代码随机:我如何使用ID对队列中的客户进行排序?
int USER_RANDOM_ID = rand.nextInt(2000) + 1;
注:我存储在ArrayList中的所有对象,我需要所有的对象推到队列。
我的问题是我如何排序这样的对象: 客户与最低ID将首先服务。
这是我的代码从列表发送对象到队列。在这里我想排序对象相关的ID号码。
AmmanQueue = new QueueImplementation();
for(int i =0; i<MainActivity.Amman.getLength(); i++)
{
AmmanQueue.enqueue(MainActivity.Amman.getEntry(i));
}
的可能的复制【如何通过性能对象的ArrayList排序?](https://stackoverflow.com/questions/2535124/how-to-sort-an-arraylist-of-objects-by -a财产) – F43nd1r
不重复我的问题是我如何将对象从数组移动到队列(排序) – saifmaher