Rumah > Soal Jawab > teks badan
[{TIME21=0, TIME22=2, TIME23=0, TIME12=0, TIME13=1, LOAN_AMT=500, TIME10=0, TIME20=0, TIME11=1, TIME17=0, TIME9=2, TIME16=0 , TIME15=0, TIME14=1, TIME5=0, REG_DT=20170517, TIME6=0, TIME19=0, TIME7=0, TIME18=1, TIME8=4, TIME1=0, TIME2=0, TIME3=0, TIME4 =0, TIME0=0}, {TIME21=3, TIME22=2, TIME23=3, TIME12=6, TIME13=7, LOAN_AMT=1000, TIME10=8, TIME20=2, TIME11=6, TIME17=6, TIME9 =7, TIME16=2, TIME15=7, TIME14=5, TIME5=0, REG_DT=20170517, TIME6=1, TIME19=1, TIME7=3, TIME18=1, TIME8=5, TIME1=0, TIME2=1 , TIME3=0, TIME4=0, TIME0=3}]
Ini ialah senarai dalam format List<Map<String,Object>> Di dalam ialah peta saya ingin menyusunnya mengikut format TIME0, TIME1, TIME2...TIME23. Kain bulu? Dan jenis seperti TIME1 ialah BigDecimal. Jangan risau tentang LOAN_AMT dan REG_DT di dalam, saya hanya menggunakan gelung untuk mendapatkan maklumat TIMExx
漂亮男人2017-05-27 17:42:50
Sebenarnya, anda hanya perlu meletakkan List<Map<String,Object>>
改成List<TreeMap<String,Object>>
...
TreeMap disusun mengikut Kay.
TreeMap<String,Object> map = new TreeMap<>();
map.put("TIME0","TIME0");
map.put("TIME22","TIME22");
map.put("TIME15","TIME15");
map.put("TIME11","TIME11");
map.put("TIME19","TIME19");
map.put("TIME1","TIME1");
System.out.println(map); // {TIME0=TIME0, TIME1=TIME1, TIME11=TIME11, TIME15=TIME15, TIME19=TIME19, TIME22=TIME22}