私のコードでは、1 つの特定のストアのすべてのエントリを取得する関数を記述しました。私のクエリはすべてのエントリを返し、これらのエントリを繰り返した後、インポート パラメータ Status を使用してクエリを削除します。
エントリは修正された形式でソートされます。最初の要素を削除した後、反復子は下から開始し、並べ替えは AtoZ からではなく ZtoA から開始します。
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]
ソートを維持することは可能ですか?
結果は次のようになります: [a, b, c, d, e, f]