我的JSON從JSONArray對象進行排序是:如何刪除重複和使用Java
[
{
"distance":32,
"stationCode":"MIG",
"name":"Midghat",
"platforms":"2"
},
{
"distance":32,
"stationCode":"MIG",
"name":"Midghat",
"platforms":"2"
},
{
"distance":69,
"stationCode":"MDDP",
"name":"Mandideep",
"platforms":"2"
},
{
"distance":69,
"stationCode":"MDDP",
"name":"Mandideep",
"platforms":"2"
},
{
"distance":18,
"stationCode":"HBD",
"name":"Hoshangabad",
"platforms":"2"
},
{
"distance":18,
"stationCode":"HBD",
"name":"Hoshangabad",
"platforms":"2"
},
{
"distance":37,
"stationCode":"CHQ",
"name":"Choka",
"platforms":"2"
},
{
"distance":37,
"stationCode":"CHQ",
"name":"Choka",
"platforms":"2"
},
{
"distance":85,
"stationCode":"HBJ",
"name":"Habibganj",
"platforms":"5"
},
{
"distance":85,
"stationCode":"HBJ",
"name":"Habibganj",
"platforms":"5"
},
{
"distance":0,
"stationCode":"ET",
"name":"ItarsiJn",
"platforms":"28"
},
{
"distance":8,
"stationCode":"PRKD",
"name":"Powerkheda",
"platforms":"2"
},
{
"distance":8,
"stationCode":"PRKD",
"name":"Powerkheda",
"platforms":"2"
},
{
"distance":55,
"stationCode":"ODG",
"name":"ObaidullaGanj",
"platforms":"2"
},
{
"distance":55,
"stationCode":"ODG",
"name":"ObaidullaGanj",
"platforms":"2"
},
{
"distance":44,
"stationCode":"BKA",
"name":"Barkhera",
"platforms":"2"
},
{
"distance":44,
"stationCode":"BKA",
"name":"Barkhera",
"platforms":"2"
},
{
"distance":79,
"stationCode":"MSO",
"name":"Misrod",
"platforms":"2"
},
{
"distance":79,
"stationCode":"MSO",
"name":"Misrod",
"platforms":"2"
},
{
"distance":25,
"stationCode":"BNI",
"name":"Budni",
"platforms":"2"
},
{
"distance":25,
"stationCode":"BNI",
"name":"Budni",
"platforms":"2"
},
{
"distance":91,
"stationCode":"BPL",
"name":"BhopalJn",
"platforms":"6"
},
{
"distance":63,
"stationCode":"ITKL",
"name":"ItayaKalan",
"platforms":"2"
},
{
"distance":63,
"stationCode":"ITKL",
"name":"ItayaKalan",
"platforms":"2"
}
]
我希望它按照距離排序和刪除重複stationCode。我嘗試過使用簡單的,如果其他人,但該過程將太多..專門爲排序相同的任何快捷方式。
發佈你已經試過的代碼,以及你的錯誤是什麼:)這樣,你會更容易學習和幫助我們! –