T (@NotNull String filePath) { String path = UriUtil.trimTrailingSlashes(filePath); int index = 0; int prefixHash = 0; IntList matches = new IntArrayList(); // check empty string for FS root if (myPathHashSet.contains(prefixHash)) { matches.add(index); } while (index < path.length()) { int nextIndex = path.indexOf('/', index + 1); if (nextIndex == -1) nextIndex = path.length(); prefixHash = FilePathHashUtil.pathHashCode(myCaseSensitive, path, index, nextIndex, prefixHash); if (myPathHashSet.contains(prefixHash)) { matches.add(nextIndex); } index = nextIndex; } for (int i = matches.size() - 1; i >= 0; i--) { String prefix = path.substring(0, matches.getInt(i)); T root = myPathMap.get(prefix); if (root != null) return root; } return null; }