public static < E > Counter < E > asCounter ( Collection < E > c ) { Counter < E > count = new ClassicCounter < E > ( ) ; for ( E elem : c ) { count . incrementCount ( elem ) ; } return count ; }
Takes in a Collection of something and makes a counter incrementing once for each object in the collection .