Code example for AtomicInteger

Methods: getgetAndSet

0
     * the count down reached zero with this fast forward call otherwise 
     * <code>false</code> 
     */ 
    public boolean fastForward() { 
        assert originalCount > 0;
        assert countDown.get() >= 0;
        return countDown.getAndSet(0) > 0;
    } 
     
    /** 
     * Returns <code>true</code> iff the count-down has reached zero. Otherwise <code>false</code> 
     */ 
    public boolean isCountedDown() { 
        assert countDown.get() >= 0;
        return countDown.get() == 0;
    } 
}