import com.google.common.collect.*; public class GoogleCollectExample { public static void main(String[] args) { ImmutableList<String> list = ImmutableList.of("A", "B", "C"); Multimap<String, Integer> multimap = HashMultimap.create(); multimap.put("key1", 1); multimap.put("key1", 2); multimap.put("key2", 3); BiMap<String, Integer> bimap = HashBiMap.create(); bimap.put("key1", 1); bimap.put("key2", 2); Iterable<String> filteredList = Iterables.filter(list, s -> s.startsWith("A")); ImmutableList<String> resultList = ImmutableList.copyOf(filteredList).reverse(); } }


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