docs: @SuppressWarnings("RedundantIfStatement")
    @RestrictTo(RestrictTo.Scope.LIBRARY)
    public boolean matches(String key, int depth) {
      if (isContainer(key)) {
        // This is an artificial layer we programatically create.
        return true;
      }
      if (depth >= keys.size()) {
        return false;
      }
      if (keys.get(depth).equals(key) ||
          keys.get(depth).equals("**") ||
          keys.get(depth).equals("*")) {
        return true;
      }
      return false;
    }