### Question:
GroupingObjectStream extends AbstractObjectStream<C> { @Nullable @Override public C readObject() { if (nextItem == null) { return null; } C group = null; while (group == null && nextItem != null) { if (handleItem(nextItem)) { nextItem = baseStream.readObject(); } else { group = finishGroup(); } } if (group == null) { group = finishGroup(); } return group; } protected  GroupingObjectStream(@WillCloseWhenClosed ObjectStream<? extends E> base); @Nullable @Override C readObject(); @Override void close();  }### Answer:
@Test public void testEmptyStream() { FirstLetterObjectStream cur = new FirstLetterObjectStream(new ArrayList<String>()); assertThat(cur.readObject(), nullValue()); }
@Test public void testSingleton() { FirstLetterObjectStream cur = new FirstLetterObjectStream(Arrays.asList("foo")); assertThat(cur.readObject(), equalTo(Arrays.asList("foo"))); assertThat(cur.readObject(), nullValue()); }