关于如何根据第二个元素对地图进行排序的任何建议? [英] Any suggestions of how I can sort the map with respect to the second element?

查看:56
本文介绍了关于如何根据第二个元素对地图进行排序的任何建议?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用地图的第二个元素对地图进行排序。有什么方法可以解决这个问题



我尝试了什么:



我在互联网上搜索,答案主要是lambda函数,但我想知道是否有其他方法。

I want to sort the map using the second element of the map. What are the methods of solving this problem

What I have tried:

I searched on the internet, the answers are mainly with lambda functions but I would like to know if there are other ways.

推荐答案

只需创建一个比较的函数这两个项目。请参阅 sort | Microsoft Docs [ ^ ]
Just create a function that compares the two items. See sort | Microsoft Docs[^]


这篇关于关于如何根据第二个元素对地图进行排序的任何建议?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆