public Collection<StackInfo> getStacks(String name) {
    Collection<StackInfo> stacks = new HashSet<>();
    for (StackInfo stack: stackMap.values()) {
      if (stack.getName().equals(name)) {
        stacks.add(stack);
      }
    }
    return stacks;
  }
Obtain all stacks for the given name.

@param name  stack name
@return A collection of all stacks with the given name.
        If no stacks match the specified name, an empty collection is returned.
ambari-server/src/main/java/org/apache/ambari/server/stack/StackManager.java