boolean (final int i, final List<Key> keys, final int parentPrefixLength) { if (i == keys.size()) return true; if (i == 0) return false; List<String> words = keys.get(i).words; List<String> prevWords = keys.get(i - 1).words; if (prevWords.size() == parentPrefixLength) return true; if (words.size() == parentPrefixLength) return true; return !Comparing.strEqual(words.get(parentPrefixLength), prevWords.get(parentPrefixLength)); }