code: void checkIsE(@NullableDecl Object element) {
      checkNotNull(element);
      if (!isActuallyE(element)) {
        throw new ClassCastException("Expected an " + type + " but got " + element);
      }
    }
docs: Returns {@code element} cast to {@code E}, if it actually is a nonnull E. Otherwise, throws
  either a NullPointerException or a ClassCastException as appropriate.