Do we need to check for the "no terms provided" case (throw IAE)? Else we seem to make a TermsAndField w/ null field? Or is that harmless (matches no docs)...? Maybe we need a test for it ...
I think the ArrayUtil.grow can be a < not a <=? Should we shrink the byte down in the end?
Can we rename .terms -> .termBytes?
Typo: "don't use case we could pollute the cache here easily" --> "don't use cache since we could pollute the cache here easily"
Typo?: "no freq if we don't need them" -> "no freq since we don't need them"
Maybe equals should also compare the hashCode first (since we compute/cache it up front)?
Should currentTermsAndField be renamed to lastTermsAndField? It's always the last "completed" field right?
Hmm I suddenly realized: I think this code is doing the same thing that FrozenBufferedDeletes does (see PrefixCodedTerms ... which takes even fewer bytes since it shares prefixes). Maybe we should just use that?