How to sort GSON Array based on a key?

后端 未结 3 715
遇见更好的自我
遇见更好的自我 2020-12-10 07:29

Consider the following is my Array

[
  {\"id\":10,\"name\":\"name10\",\"valid\":true},
  {\"id\":12,\"name\":\"name12\",\"valid\":false},
  {\"id\":11,\"name         


        
3条回答
  •  无人及你
    2020-12-10 08:07

    you can use Gson library https://sites.google.com/site/gson/gson-user-guide to get the Array(the class should implement comparable) and sort with arrays.sort();

    Thanks

提交回复
热议问题