Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

只能排int嘛 #2

Open
git-maven opened this issue Oct 19, 2022 · 3 comments
Open

只能排int嘛 #2

git-maven opened this issue Oct 19, 2022 · 3 comments

Comments

@git-maven
Copy link

自定义的对象怎么排序呢请问

@hackware1993
Copy link
Owner

这个对象一定有个基准值啊,比如 person.getAge,student.getScore()

@git-maven
Copy link
Author

这个对象一定有个基准值啊,比如 person.getAge,student.getScore()

怎么样像dart一样可以
list.compare((a, b) => a.getAge.compare(b.getAage))

@hackware1993
Copy link
Owner

我贴的代码只是展示思想,如果自己要在真实环境用的话还要封装下哦

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants