Collect all joins and its children to single collection

@param joins root joins
@return all joins, including children
488245
public static List<JoinDescription> unrollChildrenJoins(Collection<JoinDescription> joins) {
        List<JoinDescription> collection = new LinkedList<>();

        for (JoinDescription joinDescription : joins) {
            unrollChildrenInternal(joinDescription, collection);
        }

        return collection;
    }
1324598
public static final <T> Set<T> union(Collection<Set<T>> sets)
    {
        Set<T> set = new HashSet<>();
        for (Set<T> s : sets)
        {
            set.addAll(s);
        }
        return set;
    }
533286
public Map<String, Set<String>> queriesForIds(Collection<String> ids) {
        Set<String> idsWithParents = getIdsForIdsWithAncestors(ids);
        Map<String, Set<String>> queries = new HashMap<String, Set<String>>();
        for (String id : idsWithParents) {
            queries.put(id, getIdsForIdWithDescendants(id));
        }
        return queries;
    }
92092
protected function buildJoinExpressions(array $joins)
	{
		$joinExpressions = array();
		foreach($joins as $joins)
		{
			$joinExpressions[] = 'LEFT JOIN ' . $joins['table'] . ' ' . $joins['tableAlias']
					. ' ON ' . $joins['onClause'];
		}
		return $joinExpressions;
	}
1357178
public void collectFromRoot(Collection<ResourcePathNode<D>> nodes) {

    if (this.parent != null) {
      this.parent.collectFromRoot(nodes);
    }
    nodes.add(this);
  }
175112
func (db *Database) Joins(joins string) *Database {
	db = db.clone()
	db.joinTables = append(db.joinTables, joins)
	// we can't infer model from the join string (can contain everything)
	return db
}
1104786
private <T, R> void applyPredicates(JoinerQuery<T, R> request, JPAQuery query, Set<Path<?>> usedAliases, List<JoinDescription> joins) {
        if (request.getWhere() != null) {
            Predicate where = predicateAliasResolver.resolvePredicate(request.getWhere(), joins, usedAliases);
            checkAliasesArePresent(where, usedAliases);
            query.where(where);
        }
        if (request.getGroupBy() != null) {
            Map<AnnotatedElement, List<JoinDescription>> grouped = joins.stream()
                    .collect(Collectors.groupingBy(j -> j.getOriginalAlias().getAnnotatedElement()));
            Path<?> grouping = predicateAliasResolver.resolvePath(request.getGroupBy(), grouped, usedAliases);
            checkAliasesArePresent(grouping, usedAliases);
            query.groupBy(grouping);
        }
        if (request.getHaving() != null) {
            Predicate having = predicateAliasResolver.resolvePredicate(request.getHaving(), joins, usedAliases);
            checkAliasesArePresent(having, usedAliases);
            query.having(having);
        }
    }
76873
public static <T> Source<T> join(Collection<Source<T>> collection) {
        return join(collection.iterator());
    }
531297
@Nonnull
    public static <T> List<T> join(@Nonnull Collection<? extends T>... items) {
        int size = 0;
        for (Collection<? extends T> item : items)
            size += item.size();
        List<T> r = new ArrayList<>(size);
        for (Collection<? extends T> item : items)
            r.addAll(item);
        return r;
    }
1350257
public List<ComponentDto> selectByKeysAndBranches(DbSession session, Map<String, String> branchesByKey) {
    Set<String> dbKeys = branchesByKey.entrySet().stream()
      .map(entry -> generateBranchKey(entry.getKey(), entry.getValue()))
      .collect(toSet());
    return selectByDbKeys(session, dbKeys);
  }
247354
public static List<Long> childrenToReplicaHSIds(Collection<String> children)
    {
        List<Long> replicas = new ArrayList<Long>(children.size());
        for (String child : children) {
            long HSId = Long.parseLong(CoreZK.getPrefixFromChildName(child));
            replicas.add(HSId);
        }
        return replicas;
    }
1211522
public final static List<ConnectionNotation> getAllEdgeConnections(List<ConnectionNotation> connections) {
    List<ConnectionNotation> listEdgeConnection = new ArrayList<ConnectionNotation>();
    for (ConnectionNotation connection : connections) {
      if (!(connection.getrGroupSource().equals("pair"))) {
        listEdgeConnection.add(connection);
      }
    }
    return listEdgeConnection;
  }
1214316
@NonNull
    Collection<TObj> getAll() {
        Collection<TObj> result = new LinkedList<>();
        for (int countR = mData.size(), i = 0; i < countR; i++) {
            int rowKey = mData.keyAt(i);
            SparseArrayCompat<TObj> columns = mData.get(rowKey);
            for (int countC = columns.size(), j = 0; j < countC; j++) {
                int key = columns.keyAt(j);
                result.add(columns.get(key));
            }
        }
        return result;
    }
755773
public Set<Annotation> getSubTreeNodes(@NonNull Annotation node, String... childRelations) {
      Set<Annotation> children = new HashSet<>();
      Set<String> targetRel = childRelations == null ? Collections.emptySet() : Sets.asSet(
         Arrays.asList(childRelations));
      Predicate<RelationEdge> keep = edge -> targetRel.size() == 0 || targetRel.contains(edge.getRelation());

      Queue<RelationEdge> queue = new LinkedList<>(getInEdges(node).stream().filter(keep).collect(Collectors.toList()));
      while (!queue.isEmpty()) {
         RelationEdge n = queue.remove();
         if (!"relcl".equals(n.getRelation()) && !"parataxis".equals(n.getRelation())) {
            children.add(n.getFirstVertex());
            queue.addAll(getInEdges(n.getFirstVertex())
                            .stream()
                            .filter(e -> !children.contains(e.getFirstVertex()))
                            .collect(Collectors.toSet()));
         }
      }
      return children;
   }
272630
public Collection<String> generateTableJoinOrder() {
        List<JoinNode> leafNodes = generateLeafNodesJoinOrder();
        Collection<String> tables = new ArrayList<>();
        for (JoinNode node : leafNodes) {
            tables.add(node.getTableAlias());
        }
        return tables;
    }
695845
public static <T> String join(Iterable<T> iterable) {
        dbc.precondition(iterable != null, "cannot join a null iterable");
        return new JoinStrings<T>().apply(iterable.iterator());
    }
1010601
protected function prepareJoins($joins) {
        $_joins = [];
        if ($joins) {
            foreach ($joins as $join) {
                $table     = $this->dialect->getTableName($join [0]);
                $alias     = empty ($join [3]) ? $table : $join [3];
                $_joins [] = [$table, $join [1], $join [2], $alias];
            }
        }

        return $_joins;
    }