Code example for ConcurrentLinkedQueue

0
 
	public interface PredictionListener { 
		void onPrediction(double[] pred, boolean left, boolean right, boolean forward, boolean reverse);
	} 
 
  private Queue<byte[]> predictQueue = new ConcurrentLinkedQueue<byte[]>();
   
  private Thread predictThread;
	private PredictionListener listener;
	private NeuralNetwork nn;
 
  Predictor(PredictionListener listener, NeuralNetwork nn) {
  	this.listener = listener;
  	this.nn = nn;
  	predictThread = new Thread(this);
  	predictThread.start();
  } 
 
	@Override 
  public void run() { 
		while (true) {