LinkedList<ByteBuffer> dataQueue;
dataQueue = Collections.synchronizedList(new LinkedList<ByteBuffer>());
comes back incompatible type
LinkedList<ByteBuffer> dataQueue;
dataQueue = new LinkedList<ByteBuffer>();
works fine, but I know is not synchronized.
List<ByteBuffer> dataQueue;
dataQueue = Collections.synchronizedList(new LinkedList<ByteBuffer>());
does not give me access to the poll() command that I want.
Will this be safe for the second example above?
public synchronized void addDataToQueue(ByteBuffer b) {
dataQueue.add(b);
}