<dependency> <groupId>org.eclipse.collections</groupId> <artifactId>eclipse-collections-api</artifactId> <version>x.x.x</version> </dependency> <project> ... <dependencies> ... <dependency> <groupId>org.eclipse.collections</groupId> <artifactId>eclipse-collections-api</artifactId> <version>x.x.x</version> </dependency> ... </dependencies> ... </project> import org.eclipse.collections.api.list.MutableList; import org.eclipse.collections.impl.factory.Lists; import java.util.Arrays; public class Main { public static void main(String[] args) { MutableList<String> list = Lists.mutable.empty(); list.add("apple"); list.addAll(Arrays.asList("banana", "cherry")); MutableList<String> filteredList = list.select(item -> item.startsWith("a")); System.out.println(filteredList); } }


上一篇:
下一篇:
切换中文