@Test public void testTwoBufferedSpliteratorsConsumedInterchangeably() { SeqBuffer<Integer> buffer = buffer(); Spliterator<Integer> x = buffer.seq().spliterator(); assertTrue(x.tryAdvance(i -> verifyInt(1, i))); assertTrue(x.tryAdvance(i -> verifyInt(2, i))); Spliterator<Integer> y = buffer.seq().spliterator(); assertTrue(y.tryAdvance(i -> verifyInt(1, i))); assertTrue(x.tryAdvance(i -> verifyInt(3, i))); assertTrue(y.tryAdvance(i -> verifyInt(2, i))); assertTrue(y.tryAdvance(i -> verifyInt(3, i))); assertTrue(y.tryAdvance(i -> verifyInt(4, i))); assertTrue(x.tryAdvance(i -> verifyInt(4, i))); assertTrue(x.tryAdvance(i -> verifyInt(5, i))); assertTrue(y.tryAdvance(i -> verifyInt(5, i))); assertFalse(x.tryAdvance(AssertionError::new)); assertFalse(y.tryAdvance(AssertionError::new)); assertEquals(list, buffer.seq().toList()); }
Seq<T> seq() { return Seq.seq(new BufferSpliterator()); }
SeqBuffer { Seq<T> seq() { return Seq.seq(new BufferSpliterator()); } }
SeqBuffer { Seq<T> seq() { return Seq.seq(new BufferSpliterator()); } private  SeqBuffer(Spliterator<T> source); }
SeqBuffer { Seq<T> seq() { return Seq.seq(new BufferSpliterator()); } private  SeqBuffer(Spliterator<T> source);  }
SeqBuffer { Seq<T> seq() { return Seq.seq(new BufferSpliterator()); } private  SeqBuffer(Spliterator<T> source);   }