compat/src/main/java/androidx/core/view/ViewCompat.java
@SuppressWarnings("TypeParameterUnusedInFormals")
    @NonNull
    public static <T extends View> T requireViewById(@NonNull View view, @IdRes int id) {
        // TODO: use and link to View#requireViewById() directly, once available
        T targetView = view.findViewById(id);
        if (targetView == null) {
            throw new IllegalArgumentException("ID does not reference a View inside this View");
        }
        return targetView;
    }
/**
     * Finds the first descendant view with the given ID, the view itself if the ID matches
     * {@link View#getId()}, or throws an IllegalArgumentException if the ID is invalid or there
     * is no matching view in the hierarchy.
     * <p>
     * <strong>Note:</strong> In most cases -- depending on compiler support --
     * the resulting view is automatically cast to the target class type. If
     * the target class type is unconstrained, an explicit cast may be
     * necessary.
     *
     * @param id the ID to search for
     * @return a view with given ID
     * @see View#findViewById(int)
     */
Finds the first descendant view with the given ID, the view itself if the ID matches
View#getId(), or throws an IllegalArgumentException if the ID is invalid or there
is no matching view in the hierarchy.

Note: In most cases -- depending on compiler support
the resulting view is automatically cast to the target class type. If
the target class type is unconstrained, an explicit cast may be
necessary.

@param id the ID to search for
@return a view with given ID
@see View#findViewById(int)
Finds the first descendant view with the given ID the view itself if the ID matches View#getId () or throws an IllegalArgumentException if the ID is invalid or there is no matching view in the hierarchy . Note : In most cases -- depending on compiler support the resulting view is automatically cast to the target class type . If the target class type is unconstrained an explicit cast may be necessary . @param id the ID to search for @return a view with given ID @see View#findViewById ( int )
@SuppressWarnings("TypeParameterUnusedInFormals")
    @NonNull
    public static <T extends View> T requireViewById(@NonNull View view, @IdRes int id) {
        T targetView = view.findViewById(id);
        if (targetView == null) {
            throw new IllegalArgumentException("ID does not reference a View inside this View");
        }
        return targetView;
    }
@ SuppressWarnings ( "TypeParameterUnusedInFormals" ) @ NonNull public static < T extends View > T requireViewById ( @ NonNull View view , @ IdRes int id ) { T targetView = view . findViewById ( id ) ; if ( targetView == null ) { throw new IllegalArgumentException ( "ID does not reference a View inside this View" ) ; } return targetView ; }
Finds the first descendant view with the given ID, the view itself if the ID matches
 {@link View#getId()}, or throws an IllegalArgumentException if the ID is invalid or there
 is no matching view in the hierarchy.
Finds the first descendant view with the given ID the view itself if the ID matches { @link View#getId () } or throws an IllegalArgumentException if the ID is invalid or there is no matching view in the hierarchy .
// TODO: use and link to View#requireViewById() directly, once available