android/guava/src/com/google/common/collect/Sets.java
@GwtIncompatible // CopyOnWriteArraySet
  public static <E> CopyOnWriteArraySet<E> newCopyOnWriteArraySet(Iterable<? extends E> elements) {
    // We copy elements to an ArrayList first, rather than incurring the
    // quadratic cost of adding them to the COWAS directly.
    Collection<? extends E> elementsCollection =
        (elements instanceof Collection)
            ? Collections2.cast(elements)
            : Lists.newArrayList(elements);
    return new CopyOnWriteArraySet<E>(elementsCollection);
  }
@GwtIncompatible // CopyOnWriteArraySet
  public static <E> CopyOnWriteArraySet<E> newCopyOnWriteArraySet(Iterable<? extends E> elements) {
    // We copy elements to an ArrayList first, rather than incurring the
    // quadratic cost of adding them to the COWAS directly.
    Collection<? extends E> elementsCollection =
        (elements instanceof Collection)
            ? Collections2.cast(elements)
            : Lists.newArrayList(elements);
    return new CopyOnWriteArraySet<E>(elementsCollection);
  }
Creates a {@code CopyOnWriteArraySet} instance containing the given elements.

@param elements the elements that the set should contain, in order
@return a new {@code CopyOnWriteArraySet} containing those elements
@since 12.0