Code example for ArrayDeque

Methods: pollLast

0
    public boolean hasMoreSteps() { 
        return !path.isEmpty();
    } 
 
    public Location getNextStep() {
        return path.pollLast();
    } 
 
    private void makeStraightPath() { 
        Location start = location;
        Location current = start;
        Location previous = current;
        Log.w("location", "MLP - step : " + steps);
        for(int i = 0; i < steps; i++) {
            double new_latitude = calculateLatitude(previous);
            double new_longitude = calculateLongitude(previous);
            // add speed to current in direction of travel 
            // add to front of queue 
            // replace previous with current 
            //-------- 
            // when reading output, read from Last / Back / End of Queue FIFO