ordinal/src/org/immutables/ordinal/ImmutableOrdinalSet.java
@SuppressWarnings("unchecked")
  // Safe unchecked, elements are defined to be of E or subtypes of E
  // which is allowed for immutable collection
  public static <E extends OrdinalValue<E>> ImmutableOrdinalSet<E> copyOf(Iterable<? extends E> elements) {
    if (elements instanceof ImmutableOrdinalSet) {
      return (ImmutableOrdinalSet<E>) elements;
    }
    return constructFromArray(Iterables.toArray(elements, OrdinalValue.class));
  }
@SuppressWarnings("unchecked")
  // Safe unchecked, elements are defined to be of E or subtypes of E
  // which is allowed for immutable collection
  public static <E extends OrdinalValue<E>> ImmutableOrdinalSet<E> copyOf(Iterable<? extends E> elements) {
    if (elements instanceof ImmutableOrdinalSet) {
      return (ImmutableOrdinalSet<E>) elements;
    }
    return constructFromArray(Iterables.toArray(elements, OrdinalValue.class));
  }
Creates immutable ordinal set from iterable of elements.
All elements expected to have same {@link OrdinalValue#domain()} as the first element,
otherwise exception will be thrown.
@param <E> the element type
@param elements the elements, no nulls allowed
@return the immutable ordinal set