public List<String> orderedGroups(){
  int groupCount=groupCount();
  List<String> groups=new ArrayList<String>(groupCount);
  for (int i=1; i <= groupCount; i++) {
    groups.add(group(i));
  }
  return groups;
}

public List < String > orderedGroups ( ) { int groupCount = groupCount ( ) ; List < String > groups = new ArrayList < String > ( groupCount ) ; for ( int i = 1 ; i <= groupCount ; i ++ ) { groups . add ( group ( i ) ) ; } return groups ; }
gets a list of the matches in the order in which they occur in a matching input string
