boolean (String @Nullable [] parts, @Nullable String path) { if (parts == null || path == null) { return false; } int index = -1; for (String part : parts) { index = path.indexOf(part, index); if (index == -1) { return false; } } return true; }