本文整理匯總了Java中org.apache.commons.collections.CollectionUtils.filter方法的典型用法代碼示例。如果您正苦於以下問題:Java CollectionUtils.filter方法的具體用法?Java CollectionUtils.filter怎麽用?Java CollectionUtils.filter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.commons.collections.CollectionUtils
的用法示例。
在下文中一共展示了CollectionUtils.filter方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getRollbackCandidates
import org.apache.commons.collections.CollectionUtils; //導入方法依賴的package包/類
public List<MigrationTask> getRollbackCandidates(List<MigrationTask> allMigrationTasks, int[] rollbackLevels, PatchInfoStore currentPatchInfoStore) throws MigrationException
{
validateRollbackLevel(rollbackLevels);
int rollbackLevel = rollbackLevels[0];
int currentPatchLevel = currentPatchInfoStore.getPatchLevel();
if (currentPatchLevel < rollbackLevel)
{
throw new MigrationException(
"The rollback patch level cannot be greater than the current patch level");
}
PatchRollbackPredicate rollbackPredicate = new PatchRollbackPredicate(currentPatchLevel,
rollbackLevel);
List<MigrationTask> migrationCandidates = new ArrayList<MigrationTask>();
migrationCandidates.addAll(allMigrationTasks);
CollectionUtils.filter(migrationCandidates, rollbackPredicate);
Collections.sort(migrationCandidates);
// need to reverse the list do we apply the rollbacks in descending
// order
Collections.reverse(migrationCandidates);
return migrationCandidates;
}