Ngram implements Bigram<T>, Trigram<T>,
    Comparable<Ngram<T>>,
    Serializable { @Override public Iterator<T> iterator() { return new Iterator<T>() { int index = 0; @Override public boolean hasNext() { return index != length; } @Override public T next() { if (index == length) { throw new NoSuchElementException(); } return atIndex(index++); } }; } 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 testIterator() { List<String> list = new ArrayList<>(); arrayBi.iterator().forEachRemaining(list::add); assertEquals(list, Arrays.asList("c", "d")); }
@Test void testIteratorBeyond() { Iterator<String> iterator = arrayBi.iterator(); iterator.next(); iterator.next(); assertThrows(NoSuchElementException.class, iterator::next); }