code: public List<Group> getGroupsByName(final String name, final boolean matchExactly) {
          List<Group> allGroups = new ArrayList<Group>();
  
          if (root != null) {
              getGroups(root, allGroups);
          }
  
          return ListFilter.filter(allGroups, new Filter<Group>() {
  
              @Override
              public boolean matches(Group item) {
                  if (matchExactly) {
                      if (item.getName() != null && item.getName().equalsIgnoreCase(name)) {
                          return true;
                      }
                  } else {
                      if (item.getName() != null && item.getName().toLowerCase().contains(name.toLowerCase())) {
                          return true;
                      }
                  }
  
                  return false;
              }
  
          });
      }
docs: Retrieves a list of group with matching names.
  <p>
  If the <tt>matchExactly</tt> flag is true, only groups which have an
  exactly matching name will be returned, otherwise all groups which
  contain the given name will be returned.
  
  @param name
  the name which should be searched
  @param matchExactly
  if true only groups which have an exactly matching name will
  be returned
  @return a list of entries with matching names
  @see Group