Code example for Queue

Methods: add, remove, size

0
        lastTapped = new Date();
    } 
 
    public void setValue(boolean value) {
        isActive = value;
        padHistory.add(value);
 
        if (padHistory.size() > HISTORY_SIZE) {
            padHistory.remove();
        } 
    } 
 
    public boolean justTapped() { 
        Date now = new Date();
        long timeSinceTap = now.getTime() - lastTapped.getTime();
        if (isActive && timeSinceTap > TAP_TIMEOUT) {
            lastTapped = new Date();
            return true; 
        } 
        return false; 
    }