Is stream().takeWhile thread safe on LinkedBlockingQueue

80 Views Asked by At

can anyone explain me if in java

//Thread 1
BlockingQueue<String> queue = new LinkedBlockingQueue<>();
queue.put("232323232");
.....
//Thread 2
Stream<String> result = queue.stream().takeWhile(predicate);

is thread safe? ... if one thread is puts in queue and another is reading with stream takeWhile the queue data?

0

There are 0 best solutions below