フィルタメソッドを提供するJavaコレクションクラスはありますか?私はJavaに少し慣れているので、すべてのコレクションクラスをナビゲートし、インターフェイスと絡み合っている微妙なやり方はちょっと混乱します。私が欲しいのは、以下を行うコレクションクラスです:Javaでフィルタリング可能なコレクション
FilterableCollection<SomeClass> collection = new FilterableCollection<SomeClass>();
// add some elements to the collection
// filter the collection and only keep certain elements
FilterableCollection<SomeClass> filtered_collection = collection.filter(
new Filter<SomeClass>() {
@Override
public boolean test(SomeClass obj) {
// determine whether obj passes the test or not
}
}
);
[Java:コレクションをフィルタリングする最良の方法は何ですか?](http://stackoverflow.com/questions/122105/java-what-is-the-best) -way-to-filter-a-collection) –