### Question:
ImmutableCollectors { public static <T> Collector<T, ?, List<T>> toList() { return Collector.of( ImmutableList::<T>builder, ImmutableList.Builder::add, (x, y) -> { x.addAll(y.build()); return x; }, ImmutableList.Builder::build); }  static Collector<T, ?, List<T>> toList(); static Collector<T, ?, Map<K, V>> toMap(
        Function<? super T, ? extends K> keyMapper,
        Function<? super T, ? extends V> valueMapper); static Collector<T, ?, Map<K, T>> toMap(Function<? super T, ? extends K> keyMapper);  }### Answer:
@Test void toList() { String item0 = "foo"; String item1 = "bar"; List<String> list = Stream.of(item0, item1).collect(ImmutableCollectors.toList()); assertThat(list).containsExactly(item0, item1); }
@Test void toListImmutable() { List<String> list = Stream.<String>empty().collect(ImmutableCollectors.toList()); assertThatExceptionOfType(UnsupportedOperationException.class) .isThrownBy(() -> list.add("foo")); }
@Test void toListParallel() { String item0 = "foo"; String item1 = "bar"; List<String> list = Arrays.asList(item0, item1) .parallelStream() .collect(ImmutableCollectors.toList()); assertThat(list).containsExactly(item0, item1); }