In my code I have written a function to get all entries for one specific store. My query gives all entries back and after iterating in these entries, I remove the query's with the importing parameter Status.
The entries are sorted in a corrected form. After removing the first element, the iterator starts from the bottom and the sorting start from ZtoA instead of from AtoZ.
Collection col;
col = recallStoreHome.findByStoreId(storeid);
for (Iterator it = col.iterator(); it.hasNext();) {
RecallStoreEntityLocal recallStore =(RecallStoreEntityLocal) it.next();
Recall recall = this.getRecall(recallStore.getRecallid());
if(!recallStatus.equalsIgnoreCase(recall.getStatus()))
{
it.remove();
}
}
Iterator before: [a, b, c, d, e, f]
Iterator after : [a, f, e, d, c, b]
Is it possible to keep the sorting?
result should be: [a, b, c, d, e, f]