<dependency> <groupId>org.eclipse.collections</groupId> <artifactId>eclipse-collections</artifactId> <version>10.0.0</version> </dependency> import org.eclipse.collections.impl.list.mutable.FastList; public class MyLibrary { private FastList<String> myList; public MyLibrary() { myList = new FastList<>(); } public void addElement(String element) { myList.add(element); } public void removeElement(String element) { myList.remove(element); } } FastList<String> upperCaseList = myList.collect(String::toUpperCase); FastList<String> selectedList = myList.select(element -> element.length() > 5); FastList<String> rejectedList = myList.reject(element -> element.length() <= 5); boolean hasLongElement = myList.anySatisfy(element -> element.length() > 10); int totalAge = studentList.sumByInt(Student::getAge);


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