Crate a map of the expanded custom item ids and their row index.

@param expandedOnly true if expanded only
@return the map between a custom item id ands its row index
771141
private Map<String, List<Integer>> createExpandedCustomIdIndexMapping(final boolean expandedOnly) {
		TreeItemIdNode custom = getCustomTree();
		if (custom == null) {
			return Collections.EMPTY_MAP;
		}

		Set<String> expanded = null;
		if (expandedOnly) {
			expanded = getExpandedRows();
		}

		Map<String, List<Integer>> map = new HashMap<>();
		processExpandedCustomIdIndexMapping(custom, expanded, map);
		return Collections.unmodifiableMap(map);
	}
688916
public @Nullable TwinTextItem getItemById(int id) {
        for(int index = getCount()-1; index >= 0; index--) {
            TwinTextItem item = getItem(index);
            if(item.getId() == id)
                return item;
        }
        return null;
    }
682397
private List<RowIdWrapper> getRowIds(final int startIndex, final int endIndex,
			final boolean forUpdate) {
		TableModel model = getTableModel();

		// If the table is sorted, we may require a mapping for table row index <--> data model index.
		int[] rowIndexMapping = getComponentModel().rowIndexMapping;

		// Check if sort mapping needs updating
		if (isSorted() && rowIndexMapping != null && rowIndexMapping.length != model.getRowCount()) {
			rowIndexMapping = model.sort(getSortColumnIndex(), isSortAscending());
			getOrCreateComponentModel().rowIndexMapping = rowIndexMapping;
		}

		List<RowIdWrapper> rowIds = new ArrayList<>(endIndex - startIndex + 1);

		ExpandMode mode = getExpandMode();
		boolean expandable = mode != ExpandMode.NONE;

		// Expanded rows - for update, include rows that have been previously expanded
		Set<?> expanded = null;
		if (expandable) {
			expanded = forUpdate ? getPrevExpandedRows() : getExpandedRows();
		}

		// Rendered rows - for update, only process rows that have been rendered
		Set<?> rendered = null;
		int renderedCount = 0;
		if (forUpdate) {
			rendered = getPrevRenderedRows();
			// Check if no rows previously rendered
			if (rendered.isEmpty()) {
				return Collections.EMPTY_LIST;
			}
		}

		boolean editable = isEditable();

		for (int i = startIndex; i <= endIndex; i++) {
			// Create top level
			List<Integer> rowIndex = new ArrayList<>(1);

			// Map ids (if sorted)
			if (rowIndexMapping == null) {
				rowIndex.add(i);
			} else {
				rowIndex.add(rowIndexMapping[i]);
			}

			// Row key
			Object key = model.getRowKey(rowIndex);

			// For update, only process rows that have been rendered
			if (forUpdate && !rendered.contains(key)) {
				continue;
			}

			// Create wrapper
			RowIdWrapper wrapper = new RowIdWrapper(rowIndex, key, null);

			if (expandable) {
				calcChildrenRowIds(rowIds, wrapper, model, null, expanded, mode, forUpdate, editable);
			} else {
				rowIds.add(wrapper);
			}

			// For update, check if all rendered rows have been processed
			if (forUpdate) {
				renderedCount++;
				if (renderedCount == rendered.size()) {
					// No need to keep processing
					break;
				}
			}

			// For render, keep rows that have been rendered for update logic (only if table editable)
			if (editable && !forUpdate) {
				addPrevRenderedRow(key);
			}
		}

		// Set the position of each row in the list of row ids.
		int i = 0;
		for (RowIdWrapper row : rowIds) {
			row.setPosition(i++);
		}

		return rowIds;
	}
136414
public Map<String, TreeItemIdNode> getCustomIdNodeMap() {
		// No user context present
		if (getScratchMap() == null) {
			return createCustomIdNodeMapping();
		}
		Map<String, TreeItemIdNode> map = (Map<String, TreeItemIdNode>) getScratchMap().get(CUSTOM_IDS_TO_NODE_SCRATCH_MAP_KEY);
		if (map == null) {
			map = createCustomIdNodeMapping();
			getScratchMap().put(CUSTOM_IDS_TO_NODE_SCRATCH_MAP_KEY, map);
		}
		return map;
	}
1036734
public static Map<String, String> toStringMap(final Props props, final boolean localOnly) {
    final HashMap<String, String> map = new HashMap<>();
    final Set<String> keyset = localOnly ? props.localKeySet() : props.getKeySet();

    for (final String key : keyset) {
      final String value = props.get(key);
      map.put(key, value);
    }

    return map;
  }
1151446
public Multimap<Boolean, CmsCategoryTreeEntry> getEntriesIndexedByLocality() {

        return ArrayListMultimap.create(
            Multimaps.index(m_categoryEntries, new Function<CmsCategoryTreeEntry, Boolean>() {

                @SuppressWarnings("synthetic-access")
                public Boolean apply(CmsCategoryTreeEntry entry) {

                    return Boolean.valueOf(entry.getBasePath().equals(m_basePath));
                }
            }));
    }
1351196
public static <K, V> Map<K, V> toMap(Collection<Mappable<K, V>> aMappables)
	{
		if (aMappables == null)
			throw new IllegalArgumentException(
			"aMappables required in Organizer");

		Map<K, V> map = new HashMap<K, V>(aMappables.size());
		Mappable<K, V> mappable = null;
		for (Iterator<Mappable<K, V>> i = aMappables.iterator(); i.hasNext();)
		{
			mappable = i.next();
			map.put((K) mappable.getKey(), (V) mappable.getValue());
		}

		return map;
	}
1366952
public static Map mapKeys(Mapper mapper, Map map, boolean allowNull) {
        HashMap h = new HashMap();
        for (Object e : map.entrySet()) {
            Map.Entry entry = (Map.Entry) e;
            Object o = mapper.map(entry.getKey());
            if (allowNull || o != null) {
                h.put(o, entry.getValue());
            }
        }
        return h;
    }
973388
public DefaultExpander getDslExpander() {
        DefaultExpander expander = new DefaultExpander();
        if (this.dslFiles == null || this.dslFiles.isEmpty()) {
            return null;
        }
        for (DSLMappingFile file : this.dslFiles) {
            expander.addDSLMapping(file.getMapping());
        }
        return expander;
    }
1367561
public static <T> ImmutableMap<T, Integer> itemToIndexMap(final Iterable<T> sequence) {
    return itemToIndexMapStartingFrom(sequence, 0);
  }
818957
function expandItem(data) {
    // Cloning to avoid modification of the original data item.
    data = JSON.parse(JSON.stringify(data));

    if (!data.expansions) {
        data.expansions = [];
    }

    // Expansions are stored in a tree structure.
    let obj = findExpansion.call(this, data.parent);
    obj.expansions.push(data);
}
786516
public ElementUI getNextSibling(boolean visibleOnly) {
        ElementUI parent = getParent();
        
        if (parent != null) {
            int count = parent.getChildCount();
            
            for (int i = getIndex() + 1; i < count; i++) {
                ElementUI child = (ElementUI) parent.getChild(i);
                
                if (!visibleOnly || child.isVisible()) {
                    return child;
                }
            }
        }
        
        return null;
    }
199870
public OnItemBindClass<T> map(@NonNull Class<? extends T> itemClass, final int variableId, @LayoutRes final int layoutRes) {
        int index = itemBindingClassList.indexOf(itemClass);
        if (index >= 0) {
            itemBindingList.set(index, itemBind(variableId, layoutRes));
        } else {
            itemBindingClassList.add(itemClass);
            itemBindingList.add(itemBind(variableId, layoutRes));
        }
        return this;
    }
950224
private void processCheckExpandedCustomNodes(final TreeItemIdNode node, final Set<String> expandedRows) {
		// Node has no children
		if (!node.hasChildren()) {
			return;
		}

		// Check node is expanded
		boolean expanded = getExpandMode() == WTree.ExpandMode.CLIENT || expandedRows.contains(node.getItemId());
		if (!expanded) {
			return;
		}

		if (node.getChildren().isEmpty()) {
			// Add children from the model
			loadCustomNodeChildren(node);
		} else {
			// Check the expanded child nodes
			for (TreeItemIdNode child : node.getChildren()) {
				processCheckExpandedCustomNodes(child, expandedRows);
			}
		}
	}
152205
@StaplerDispatchable
    public ExtensionList getExtensionList(String extensionType) throws ClassNotFoundException {
        return getExtensionList(pluginManager.uberClassLoader.loadClass(extensionType));
    }
91829
public static Map<String, List<Object>> getListMap(Message message, List<ExpressionMapping> expressionMappings, boolean expand, String undefinedVariable) {
        return getListMap(message, expressionMappings, expand, undefinedVariable, null);
    }
732283
public static Collection map(Mapper mapper, Enumeration en, boolean allowNull) {
        ArrayList l = new ArrayList();
        while (en.hasMoreElements()) {
            Object o = mapper.map(en.nextElement());
            if (allowNull || o != null) {
                l.add(o);
            }
        }
        return l;
    }