如何在 Java 中使用 SortedList

How to use SortedList in Java

我在 C# 中有这种列表

public SortedList<int, SortedList<int, Match>> TournamentRoundMatches { get; private set; }

如何写成Java?

我尝试使用 SortedSet 但它不起作用...

SortedSet<Integer, SortedSet<Integer, Match>> TournamentRoundMatches = new SortedSet<Integer, SortedSet<Integer, Match>>(){}

谢谢

名称 SortedList 实际上是误导性的,因为它不是一个排序列表,而是一个排序字典(按其键排序)。 SortedList 的最佳可比较 Java 等价物是 TreeMap:

TreeMap<Integer, TreeMap<Integer, Match>> TournamentRoundMatches = new TreeMap<Integer, TreeMap<Integer, Match>>(){}