CharSegment[] (@NotNull CharSequence path, boolean forAddition) { int start = 0; boolean asBytes = forAddition && IOUtil.isAscii(path); List<CharSegment> key = new ArrayList<>(); SubSegment flyweightKey = new SubSegment(); while (start < path.length()) { flyweightKey.findSubStringUntilNextSeparator(path, start); CharSegment interned = myInternMap.get(flyweightKey); if (interned == null) { if (!forAddition) { return null; } myInternMap.intern(interned = flyweightKey.createPersistentCopy(asBytes)); } key.add(interned); start += flyweightKey.length(); } return key.toArray(new CharSegment[0]); }