Exemplo n.º 1
0
  public void testBuilderAddAllHandlesNullsCorrectly() {
    ImmutableSet.Builder<String> builder = this.<String>builder();
    try {
      builder.addAll((Iterable<String>) null);
      fail("expected NullPointerException"); // COV_NF_LINE
    } catch (NullPointerException expected) {
    }

    try {
      builder.addAll((Iterator<String>) null);
      fail("expected NullPointerException"); // COV_NF_LINE
    } catch (NullPointerException expected) {
    }

    builder = this.<String>builder();
    List<String> listWithNulls = asList("a", null, "b");
    try {
      builder.addAll(listWithNulls);
      fail("expected NullPointerException"); // COV_NF_LINE
    } catch (NullPointerException expected) {
    }

    Iterable<String> iterableWithNulls = MinimalIterable.of("a", null, "b");
    try {
      builder.addAll(iterableWithNulls);
      fail("expected NullPointerException"); // COV_NF_LINE
    } catch (NullPointerException expected) {
    }
  }
Exemplo n.º 2
0
 public Builder addAll(Iterator paramIterator)
 {
   super.addAll(paramIterator);
   return this;
 }
Exemplo n.º 3
0
 public Builder addAll(Iterable paramIterable)
 {
   super.addAll(paramIterable);
   return this;
 }
 public Builder addAll(Iterator iterator1) {
   super.addAll(iterator1);
   return this;
 }
 public Builder addAll(Iterable iterable) {
   super.addAll(iterable);
   return this;
 }
Exemplo n.º 6
0
 /**
  * Adds each element of {@code elements} to the {@code ImmutableSortedSet}, ignoring duplicate
  * elements (only the first duplicate element is added).
  *
  * @param elements the elements to add to the {@code ImmutableSortedSet}
  * @return this {@code Builder} object
  * @throws NullPointerException if {@code elements} contains a null element
  */
 @Override
 public Builder<E> addAll(Iterator<? extends E> elements) {
   super.addAll(elements);
   return this;
 }