Home > Back-end >  Will urban domestic output in alphabetical order, and for the fixed format
Will urban domestic output in alphabetical order, and for the fixed format

Time:10-30

Format:
List [
[A] : [{anshan}, {}],
[B] : [{baotou}, {}],
[C] : [{changping}, {}]
]
By analogy, bosses, please provide a train of thought or have code posted for learning how to learn,
A rookie, do not spray,

CodePudding user response:

Construct a HashMap, and then sorted by Key, and then the output line,
SortedMap Sort=new TreeMap (map);

CodePudding user response:

I'm sorry, just made a mistake, the following is the correct
Format:
"A list" [
"A" : [{anshan}, {}],
"B" : [{baotou}, {}],
"C" : [{changping}, {}]
]

CodePudding user response:

refer to the second floor m0_48036920 response:
I'm sorry, just made a mistake, the following is the correct
Format:
"A list" [
"A" : [{anshan}, {}],
"B" : [{baotou}, {}],
"C" : [{changping}, {}]
]
this is not a map, the key for the letter, the value for list types of city name with key order directly, and then on the value

CodePudding user response:

reference 3 floor scene at the beginning of JingChu, reply:
Quote: refer to the second floor m0_48036920 response:
I'm sorry, just made a mistake, the following is the correct
Format:
"A list" [
"A" : [{anshan}, {}],
"B" : [{baotou}, {}],
"C" : [{changping}, {}]
]
this is not a map, the key for the letter, the value for list types of city name with key order directly, and then put into the value

City is a separate input, no letters, that the key to do?
Baotou, for example, anshan, changping, the output is the effect of the above, according to Chinese initials after sorting, into the array, the array in front of A, B, C how do appear,
It can write it for me?

CodePudding user response:

reference 1/f, old zizhu reply:
constructs a HashMap, and then sorted by Key, then the output line,
SortedMap Sort=new TreeMap (map);

City is a separate input, this key?
For example, baotou, anshan, changping,
Output is the effect of the above, according to Chinese initials after sorting, into the array, the array in front of A, B, C how do appear,
It can write it for me?

CodePudding user response:

Chinese pinyin, there are a lot of open source

CodePudding user response:

Get a map CodePudding user response:

refer to the eighth floor wangshutong0907 response:
get a map

Has been solved, but questions about polyphone need to do?

CodePudding user response:

references 9 f m0_48036920 response:
Quote: refer to the eighth floor wangshutong0907 response:
get a map

Has been solved, but questions about polyphone need to do?

We used that is made of the dictionary file, waiting Yu Quanlie out, to program, and when to use what pronunciation,
  • Related