@Test
  public void whenCalculateUnionOfSets_thenCorrect() {
    final Set<Character> first = ImmutableSet.of('a', 'b', 'c');
    final Set<Character> second = ImmutableSet.of('b', 'c', 'd');

    final Set<Character> union = Sets.union(first, second);
    assertThat(union, containsInAnyOrder('a', 'b', 'c', 'd'));
  }
  @Test
  public void whenCalculatingSetIntersection_thenCorrect() {
    final Set<Character> first = ImmutableSet.of('a', 'b', 'c');
    final Set<Character> second = ImmutableSet.of('b', 'c', 'd');

    final Set<Character> intersection = Sets.intersection(first, second);
    assertThat(intersection, containsInAnyOrder('b', 'c'));
  }
  @Test
  public void whenCalculatingPowerSet_thenCorrect() {
    final Set<Character> chars = ImmutableSet.of('a', 'b');
    final Set<Set<Character>> result = Sets.powerSet(chars);

    final Set<Character> empty = ImmutableSet.<Character>builder().build();
    final Set<Character> a = ImmutableSet.of('a');
    final Set<Character> b = ImmutableSet.of('b');
    final Set<Character> aB = ImmutableSet.of('a', 'b');

    assertThat(result, contains(empty, a, b, aB));
  }
  @Test
  public void whenCalculateSetsProduct_thenCorrect() {
    final Set<Character> first = ImmutableSet.of('a', 'b');
    final Set<Character> second = ImmutableSet.of('c', 'd');
    final Set<List<Character>> result = Sets.cartesianProduct(ImmutableList.of(first, second));

    final Function<List<Character>, String> func =
        new Function<List<Character>, String>() {
          @Override
          public final String apply(final List<Character> input) {
            return Joiner.on(" ").join(input);
          }
        };

    final Iterable<String> joined = Iterables.transform(result, func);
    assertThat(joined, containsInAnyOrder("a c", "a d", "b c", "b d"));
  }
  @Test
  public void whenRemoveDuplicatesFromList_thenRemoved() {
    final List<Character> chars = Lists.newArrayList('h', 'e', 'l', 'l', 'o');
    assertEquals(5, chars.size());

    final List<Character> result = ImmutableSet.copyOf(chars).asList();
    assertThat(result, contains('h', 'e', 'l', 'o'));
  }