docs: function (items, selectedValues, selectedIdx) {
              var arrayUtil = ariaUtilsArray;
              var preselect = this._checkPreselect(selectedIdx);
              selectedIdx = (preselect === undefined) ? selectedIdx : preselect;
              var maxSelectedCount = this._getTrueMaxSelectedCount(items);
              var pbMaxSelected = false; // true if the number of selected values is greater than maxSelectedCount
  
              // Items can be taken directly from the array or from another array
              // Identify from which container we'll take the items and from which properties.
              var container = items;
              var labelProperty = "label";
              var ariaLabelProperty = "ariaLabel";
              var valueProperty = "value";
              var disabledProperty = "disabled";
              if (!ariaUtilsType.isArray(items)) {
                  container = items.container;
                  labelProperty = items.labelProperty;
                  ariaLabelProperty = items.ariaLabelProperty;
                  valueProperty = items.valueProperty;
                  disabledProperty = items.disabledProperty;
              }
  
              // Merge the item data and info about selection in one array for simpler template construction
              var listItems = [];
              var selectedIndex = -1;
              var selectedCount = 0;
              for (var item = 0, length = container.length; item < length; item++) {
                  var itemObj = container[item];
                  var itemSelected = selectedValues ? arrayUtil.contains(selectedValues, itemObj[valueProperty])
                          || selectedIdx === item : false;
                  if (items[item].disabled) {
                      itemSelected = false;
                  }
                  if (itemSelected) {
                      if (selectedCount < maxSelectedCount) {
                          selectedCount++;
                          if (selectedIndex != null) {
                              if (selectedIndex == -1) {
                                  selectedIndex = item; // only one item is selected
                              } else {
                                  selectedIndex = null; // multiple items are selected
                              }
                          }
                      } else {
                          pbMaxSelected = true;
                          // we do as if this item was not selected, as we have reached the
                          // maximum number of selected items
                          itemSelected = false;
                      }
                  }
                  var initiallyDisabled = disabledProperty ? itemObj[disabledProperty] : false;
                  listItems[item] = {
                      index : item,
                      label : itemObj[labelProperty],
                      ariaLabel : itemObj[ariaLabelProperty],
                      value : itemObj[valueProperty],
                      object : itemObj,
                      selected : itemSelected,
                      initiallyDisabled : initiallyDisabled,
                      currentlyDisabled : initiallyDisabled
                      // currentlyDisabled will be updated at the end if the maximum number of selected items has been
                      // reached
                  };
              }
              // check if the maximum number of items has been reached:
              if (selectedCount == maxSelectedCount) {
                  // in this case, all the unselected items must be disabled:
                  for (var item = 0, length = listItems.length; item < length; item++) {
                      if (!listItems[item].selected) {
                          listItems[item].currentlyDisabled = true;
                      }
                  }
              }
  
              // In case of single selection mode, we keep track of the current selected index
              // to avoid looping through all elements when doing new selection.
              return {
                  items : listItems,
                  pbMaxSelected : pbMaxSelected,
                  selectedIndex : selectedIndex,
                  selectedCount : selectedCount
              };
          }