car/src/main/java/androidx/car/app/CarListDialog.java
private void initializeWithSections(DialogSubSection[] sections) {
        Context context = getContext();
        List<ListItem> listItems = new ArrayList<>();

        for (DialogSubSection section : sections) {
            SubheaderListItem header = new SubheaderListItem(getContext(), section.getTitle());
            header.setHideDivider(true);

            listItems.add(header);

            String[] items = section.getItems();
            // Now initialize all the items associated with this subsection.
            for (int i = 0, length = items.length; i < length; i++) {
                listItems.add(createItem(/* text= */ items[i], /* position= */ i));
            }
        }

        mAdapter = new ListItemAdapter(context, new ListItemProvider.ListProvider(listItems));
    }
/**
     * Initializes the {@link #mAdapter} to display the sections in the given array. It utilizes
     * the {@link SubheaderListItem} to display the section title and {@link TextListItem} to
     * display the individual items of a section.
     */
Initializes the  #mAdapter to display the sections in the given array. It utilizes
the  SubheaderListItem to display the section title and  TextListItem to
display the individual items of a section.
Initializes the #mAdapter to display the sections in the given array . It utilizes the SubheaderListItem to display the section title and TextListItem to display the individual items of a section .
private void initializeWithSections(DialogSubSection[] sections) {
        Context context = getContext();
        List<ListItem> listItems = new ArrayList<>();
        for (DialogSubSection section : sections) {
            SubheaderListItem header = new SubheaderListItem(getContext(), section.getTitle());
            header.setHideDivider(true);
            listItems.add(header);
            String[] items = section.getItems();
            for (int i = 0, length = items.length; i < length; i++) {
                listItems.add(createItem(/* text= */ items[i], /* position= */ i));
            }
        }
        mAdapter = new ListItemAdapter(context, new ListItemProvider.ListProvider(listItems));
    }
private void initializeWithSections ( DialogSubSection [ ] sections ) { Context context = getContext ( ) ; List < ListItem > listItems = new ArrayList < > ( ) ; for ( DialogSubSection section : sections ) { SubheaderListItem header = new SubheaderListItem ( getContext ( ) , section . getTitle ( ) ) ; header . setHideDivider ( true ) ; listItems . add ( header ) ; String [ ] items = section . getItems ( ) ; for ( int i = 0 , length = items . length ; i < length ; i ++ ) { listItems . add ( createItem ( /* text= */ items [ i ] , /* position= */ i ) ) ; } } mAdapter = new ListItemAdapter ( context , new ListItemProvider . ListProvider ( listItems ) ) ; }
Initializes the {@link #mAdapter} to display the sections in the given array.
Initializes the { @link #mAdapter } to display the sections in the given array .
// Now initialize all the items associated with this subsection.