// Wordcount
Public static void maptest () {string text = "constructs a list containing the elements of the specified" + "collection, in the order they are returned by the collection's iterator. "+" C the collection whose elements are to be placed into this list "+" nullpointerexception if the specified collection is null "; treemap <string, integer> map = new treemap <string, integer> (); string [] words = text. s Plit ("[\ n \ t \ r .,;:!? () {] "); For (INT I = 0; I <words. length; I ++) {string key = words [I]. tolowercase (); If (key. length ()> 0) {If (map. get (key) = NULL) map. put (Key, 1); else {int value = map. get (key ). intvalue (); Value ++; map. put (Key, value) ;}}set <map. entry <string, integer> entryset = map. entryset (); For (map. entry <string, integer> entry: entryset) system. out. println (entry. getvalue () + "\ t" + entry. getkey ());}