public double setCount ( T element , double count ) { AtomicDouble t = map . get ( element ) ; if ( t != null ) { double val = t . getAndSet ( count ) ; dirty . set ( true ) ; return val ; } else { map . put ( element , new AtomicDouble ( count ) ) ; totalCount . addAndGet ( count ) ; return 0 ; } }
This method sets new counter value for given element