<dependency> <groupId>org.eclipse.collections</groupId> <artifactId>eclipse-collections-api</artifactId> <version>11.2.0</version> </dependency> <dependency> <groupId>org.eclipse.collections</groupId> <artifactId>eclipse-collections</artifactId> <version>11.2.0</version> </dependency> import org.eclipse.collections.api.list.ImmutableList; import org.eclipse.collections.impl.factory.Lists; import org.eclipse.collections.impl.utility.Iterate; public class EclipseCollectionsExample { public static void main(String[] args) { ImmutableList<Integer> numbers = Lists.mutable.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); ImmutableList<Integer> filteredNumbers = numbers.select(num -> num > 5); ImmutableList<String> stringNumbers = filteredNumbers.collect(String::valueOf); System.out.println(stringNumbers.makeString(", ")); } }


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