您可以尝试使用Apache Commons Collections。
有一个CollectionUtils类,允许您通过自定义谓词选择或过滤项目。
您的代码将如下所示:
Predicate condition = new Predicate() { boolean evaluate(Object sample) { return ((Sample)sample).value3.equals("three"); }};List result = CollectionUtils.select( list, condition );更新:
在 java8中 ,使用 Lambdas
和StreamAPI应该是:
List<Sample> result = list.stream() .filter(item -> item.value3.equals("three")) .collect(Collectors.toList());好多了!



