public Stream < T > stream ( ) { if ( thread == null ) { synchronized ( this ) { if ( thread == null ) { thread = new Thread ( ( ) -> read ( queue ) ) ; thread . setDaemon ( true ) ; thread . start ( ) ; } } } @ Nullable final Iterator < T > iterator = new AsyncListIterator <> ( queue , thread ) ; return StreamSupport . stream ( Spliterators . spliteratorUnknownSize ( iterator , Spliterator . DISTINCT ) , false ) . filter ( x -> x != null ) ; }
Stream stream .