previousGroupLeader == null ? count - 1 : previousGroupLeader.collapsedCount + count)); Object2BooleanLinkedOpenHashMap<BytesRef> bytesRefs = scoreGroups.get(score); if (bytesRefs == null) { bytesRefs = new Object2BooleanLinkedOpenHashMap<>(); bytesRefs = scoreGroups.get(previousGroupLeader.score); bytesRefs.remove(newBytesRef, true); if (bytesRefs.isEmpty()) bytesRefs = scoreGroups.get(firstScoreKey); final BytesRef lastKey = bytesRefs.lastKey(); bytesRefs.removeLastBoolean();