boolean (@NotNull String string, String @NotNull ... prefixes) { int offset = 0; for (String prefix : prefixes) { int prefixLen = prefix.length(); if (!string.regionMatches(offset, prefix, 0, prefixLen)) { return false; } offset += prefixLen; } return true; }