boolean (@NotNull String text, @NotNull List<? extends TextRange> words) { for (TextRange word : words) { CharacterIterator it = new StringCharacterIterator(text, word.getStartOffset(), word.getEndOffset(), word.getStartOffset()); for (char c = it.first(); c != CharacterIterator.DONE; c = it.next()) { if (!Character.isUpperCase(c)) { return false; } } } return true; }