public static < T1 , T2 > Counter < T2 > transform ( Counter < T1 > c , Function < T1 , T2 > f ) { Counter < T2 > c2 = new ClassicCounter < T2 > ( ) ; for ( T1 key : c . keySet ( ) ) { c2 . setCount ( f . apply ( key ) , c . getCount ( key ) ) ; } return c2 ; }
Returns the counter with keys modified according to function F . Eager evaluation .