import org.apache.commons.collections4.list.FastArrayList; fastArrayList.add("item1"); fastArrayList.add("item2"); // ... import org.apache.commons.collections4.map.LinkedMap; cache.put(1, "Item 1"); cache.put(2, "Item 2"); // ... import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.PredicateUtils; import org.apache.commons.collections4.TransformerUtils; List<String> list = Arrays.asList("Item 1", "Item 2", "Item 3"); List<Integer> lengths = (List<Integer>) CollectionUtils.collect(list, TransformerUtils.stringValueTransformer(String::length)); List<String> filteredList = (List<String>) CollectionUtils.select(list, PredicateUtils.notNull());


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