code: public Map<String, String> findMatches(String incoming) {
          String[] pieces = incoming.split(PATH_SEPARATOR);
          int i = 0;
  
          //too many matchers, short circuit
          if (path.size() > pieces.length)
              return null;
  
          Map<String, String> values = new HashMap<String, String>();
          for (PathMatcher pathMatcher : path) {
  
              //sanity to prevent fencepost
              if (i == pieces.length)
                  return pathMatcher.matches("") ? values : null;   //go greedy on index paths
  
              String piece = pieces[i];
  
              if (!pathMatcher.matches(piece))
                  return null;
  
              //store variable as needed
              final String name = pathMatcher.name();
              if (null != name)
                  values.put(name, piece);
  
              //next piece
              i++;
          }
  
          return (i == pieces.length) ? values : null;
      }
docs: TODO this whole path matching algorithm is in linear time, could easily be constant time