<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>30.1-jre</version>
</dependency>
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
List<String> list = Lists.newArrayList("apple", "banana", "orange");
Set<Integer> set = Sets.newHashSet(1, 2, 3);
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
List<String> list = Lists.newArrayList("apple", "banana", "orange");
List<String> immutableList = ImmutableList.copyOf(list);
Set<Integer> set1 = ImmutableSet.of(1, 2, 3);
Set<Integer> set2 = ImmutableSet.copyOf(set1);
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
List<String> list = Lists.newArrayList("apple", "banana", "orange");
List<String> filteredList = Lists.newArrayList(Collections2.filter(list, s -> s.length() > 5));
Set<Integer> set = Sets.newHashSet(1, 2, 3);
Set<String> transformedSet = Sets.newHashSet(Collections2.transform(set, i -> "Number " + i));
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
List<String> list1 = Lists.newArrayList("apple", "banana", "orange");
List<String> list2 = Lists.newArrayList("banana", "grape", "kiwi");
Set<String> union = Sets.union(Sets.newHashSet(list1), Sets.newHashSet(list2));
Set<String> intersection = Sets.intersection(Sets.newHashSet(list1), Sets.newHashSet(list2));
Set<String> difference = Sets.difference(Sets.newHashSet(list1), Sets.newHashSet(list2));