lifecycle/extensions/src/main/java/androidx/lifecycle/ViewModelProviders.java
@NonNull
    @MainThread
    public static ViewModelProvider of(@NonNull Fragment fragment, @Nullable Factory factory) {
        Application application = checkApplication(checkActivity(fragment));
        if (factory == null) {
            factory = ViewModelProvider.AndroidViewModelFactory.getInstance(application);
        }
        return new ViewModelProvider(fragment.getViewModelStore(), factory);
    }
/**
     * Creates a {@link ViewModelProvider}, which retains ViewModels while a scope of given
     * {@code fragment} is alive. More detailed explanation is in {@link ViewModel}.
     * <p>
     * It uses the given {@link Factory} to instantiate new ViewModels.
     *
     * @param fragment a fragment, in whose scope ViewModels should be retained
     * @param factory  a {@code Factory} to instantiate new ViewModels
     * @return a ViewModelProvider instance
     */
Creates a  ViewModelProvider, which retains ViewModels while a scope of given
fragment is alive. More detailed explanation is in  ViewModel.

It uses the given  Factory to instantiate new ViewModels.

@param fragment a fragment, in whose scope ViewModels should be retained
@param factory  a  Factory to instantiate new ViewModels
@return a ViewModelProvider instance
Creates a ViewModelProvider which retains ViewModels while a scope of given fragment is alive . More detailed explanation is in ViewModel . It uses the given Factory to instantiate new ViewModels . @param fragment a fragment in whose scope ViewModels should be retained @param factory a Factory to instantiate new ViewModels @return a ViewModelProvider instance
@NonNull
    @MainThread
    public static ViewModelProvider of(@NonNull Fragment fragment, @Nullable Factory factory) {
        Application application = checkApplication(checkActivity(fragment));
        if (factory == null) {
            factory = ViewModelProvider.AndroidViewModelFactory.getInstance(application);
        }
        return new ViewModelProvider(fragment.getViewModelStore(), factory);
    }
@ NonNull @ MainThread public static ViewModelProvider of ( @ NonNull Fragment fragment , @ Nullable Factory factory ) { Application application = checkApplication ( checkActivity ( fragment ) ) ; if ( factory == null ) { factory = ViewModelProvider . AndroidViewModelFactory . getInstance ( application ) ; } return new ViewModelProvider ( fragment . getViewModelStore ( ) , factory ) ; }
Creates a {@link ViewModelProvider}, which retains ViewModels while a scope of given
 {@code fragment} is alive.
Creates a { @link ViewModelProvider } which retains ViewModels while a scope of given { @code fragment } is alive .