code: public static List<String> expand(String filePattern) throws IOException {
      List<String> fullyExpanded = new ArrayList<String>();
      List<StringWithOffset> toExpand = new ArrayList<StringWithOffset>();
      toExpand.add(new StringWithOffset(filePattern, 0));
      while (!toExpand.isEmpty()) {
        StringWithOffset path = toExpand.remove(0);
        List<StringWithOffset> expanded = expandLeftmost(path);
        if (expanded == null) {
          fullyExpanded.add(path.string);
        } else {
          toExpand.addAll(0, expanded);
        }
      }
      return fullyExpanded;
    }
docs: Expand globs in the given <code>filePattern</code> into a collection of
  file patterns so that in the expanded set no file pattern has a
  slash character ("/") in a curly bracket pair.
  @param filePattern
  @return expanded file patterns
  @throws IOException