public static ImmutableSet<TypeElement> asTypeElements(Iterable<? extends TypeMirror> mirrors) {
    checkNotNull(mirrors);
    ImmutableSet.Builder<TypeElement> builder = ImmutableSet.builder();
    for (TypeMirror mirror : mirrors) {
      builder.add(asTypeElement(mirror));
    }
    return builder.build();
  }
An alternate implementation of {@link Types#asElement} that does not require a {@link Types}
instance with the notable difference that it will throw {@link IllegalArgumentException}
instead of returning null if the {@link TypeMirror} can not be converted to an {@link Element}.

@throws NullPointerException if {@code typeMirror} is {@code null}
@throws IllegalArgumentException if {@code typeMirror} cannot be converted to an {@link
    Element}
common/src/main/java/com/google/auto/common/MoreTypes.java