How To Sort List of Maps?

How To Sort List of Maps?

I have the following below; If I return Collection(keyList) at the bottom, keyList is sorted correctly (I've tried both true and false and it works). But when I add to my sortedList in the order of my keyList the sortedList is not sorting how I want - its just returning unsortedList as-is. I got this syntax/help from another website...any other ideas out there?
  1. unsortedList = invokeurl
  2. [
  3. url :"https://api.discogs.com/database/search?token=helloZoho"
  4. type :GET
  5. parameters:paramsMap
  6. ];
  7. sortKey = "id";
  8. keyList = List();
  9. for each  u in unsortedList.getJson("results")
  10. {
  11. keyList.add(u.getJson(sortKey));
  12. }
  13. keyList = keyList.distinct().sort(true);
  14. sortedList = List();
  15. for each  k in keyList
  16. {
  17. for each  u in unsortedList
  18. {
  19. if(u.getJson(sortKey) == k)
  20. {
  21. sortedList.add(u);
  22. }
  23. }
  24. }
  25. return Collection(sortedList);
    Zoho Desk Resources

    • Desk Community Learning Series


    • Digest


    • Functions


    • Meetups


    • Kbase


    • Resources


    • Glossary


    • Desk Marketplace


    • MVP Corner


    • Word of the Day


      Zoho CRM Plus Resources

        Zoho Books Resources


          Zoho Subscriptions Resources

            Zoho Projects Resources


              Zoho Sprints Resources


                Zoho Orchestly Resources


                  Zoho Creator Resources


                    Zoho WorkDrive Resources



                      Zoho Campaigns Resources

                        Zoho CRM Resources

                        • CRM Community Learning Series

                          CRM Community Learning Series


                        • Tips

                          Tips

                        • Functions

                          Functions

                        • Meetups

                          Meetups

                        • Kbase

                          Kbase

                        • Resources

                          Resources

                        • Digest

                          Digest

                        • CRM Marketplace

                          CRM Marketplace

                        • MVP Corner

                          MVP Corner




                          Zoho Writer Writer

                          Get Started. Write Away!

                          Writer is a powerful online word processor, designed for collaborative work.

                            Zoho CRM コンテンツ




                              ご検討中の方