List<String> (@NotNull String qname) { List<String> toExclude = new ArrayList<>(); while (true) { toExclude.add(qname); final int i = qname.lastIndexOf('.'); if (i < 0 || i == qname.indexOf('.')) break; qname = qname.substring(0, i); } return toExclude; }