java - HashMap: sorting key into alphabetical order with it's mapped values -


i asked question here while ago, fixed it, have run problem.

this jumblesordered arraylist: [act, opst, dgo, art, aprt, fgor] jumbles arraylist: [atc, otsp, gdo, atr, arpt, grof]  dictionaryordered arraylist: [act, act, act, dgo, dgo, opst, opst, opst, opst, opst, opst, art, art, art, aprt, aprt, aprt, fglo, fglo, fgor, gopr, glos] dictionary arraylist: [act, cat, tac, dog, god, post, pots, stop, spot, tops, opts, rat, tar, art, trap, tarp, part, flog, golf, frog, gorp, slog]  jumblewordhm: {opst=otsp, art=atr, fgor=grof, aprt=arpt, dgo=gdo, act=atc} dictwordhm: {opst=post pots stop spot tops opts, art=rat tar art, glos=slog, gopr=gorp, fgor=frog, aprt=trap tarp part, dgo=dog god, act=act cat tac, fglo=flog golf}current output: 

current output:

atc act cat tac otsp post pots stop spot tops opts gdo dog god atr rat tar art arpt trap tarp part grof frog 

desired output:

arpt part tarp trap atc act cat tac atr art rat tar gdo dog god grof frog otsp opts post pots spot stop tops 

my code printing out current output:

    (int = 0; < jumblesordered.size(); i++) {         string wordanswer = jumblesordered.get(i);         system.out.println(jumbles.get(i) + " " + dictwordhm.get(wordanswer));      } 

the first word of each line scrambled word, , subsequent words dictionary words can made scrambled letters.

my problem want organize scrambled words alphabetical order like:

arpt - dictionary words atc - dictionary words atr - dictionary words etc..... 

hashmap cannot sorted, should use kind of sorted map, treemap, maps can sort keys. (treeset beneficial, takes key , sorts them automatically.)


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -