Ngram implements Bigram<T>, Trigram<T>,
    Comparable<Ngram<T>>,
    Serializable { @Override public int compareTo(Ngram<T> o) { int compare = Integer.compare(length, o.length); if (compare != 0) { return compare; } for (int i = 0; i < length; i++) { compare = atIndex(i).compareTo(o.atIndex(i)); if (compare != 0) { return compare; } } return 0; } Ngram(T[] backingArray, int length, int offset); static Ngram<S> create(S first, S second); static Ngram<S> create(S first, S second,
      S third); static Ngram<S> bigram(S[] array, int index); static Ngram<S> trigram(S[] array, int index); @Override Ngram<T> tail(); @Override Ngram<T> head(); @Override T getFirst(); @Override T getSecond(); @Override T getThird(); @Override int compareTo(Ngram<T> o); @Override Iterator<T> iterator(); @Override boolean equals(@Nullable Object o); @Override int hashCode(); @Override String toString();  }
@Test void testCompareToDifferentLength() { assertNotEquals(bigram.compareTo(trigram), 0, "Different length ngrams should not be equal when compared"); }
@Test void testCompareToDifferentValues() { assertNotEquals(bigram.compareTo(arrayBi), 0, "Ngrams containing different values should not be equal when compared"); }