我想將下面的數據轉換成某種形式的Java結構。 這些數據代表了一場網球比賽,喬在6-3,6-4擊敗肯,而莎莉以6-4,2-6,6-1,擊敗露西。 據我所知,我應該可以使用正常的地圖,像這樣的東西Map1<Key1, Map2<Key2, Map3<Key3, Value>>>
什麼讓我失望的是,我不會去每一次的最後一層(GameResult)。查看FixtureResult和MatchResult的變量作爲示例。此外,每隔的MatchResult將有多個GameResult套,所以我怎麼給從MatchResult的(父)的角度這些GameResult對象唯一鍵?具有多層的Java地圖
<FixtureResult>
<Id>1</Id>
<FixtureId>1</FixtureId>
<DateSubmitted>07-01-2017</DateSubmitted>
<MatchResult>
<Id>1</Id>
<WinnerName>Joe</WinnerName>
<LoserName>Ken</LoserName>
<GameResult>
<Id>1</Id>
<WinnerPoints>6</WinnerPoints>
<LoserPoints>3</LoserPoints>
<Ordinal>1</Ordinal>
</GameResult>
<GameResult>
<Id>2</Id>
<WinnerPoints>6</WinnerPoints>
<LoserPoints>4</LoserPoints>
<Ordinal>2</Ordinal>
</GameResult>
</MatchResult>
<MatchResult>
<Id>2</Id>
<WinnerName>Sally</WinnerName>
<LoserName>Lucy</LoserName>
<GameResult>
<Id>3</Id>
<WinnerPoints>6</WinnerPoints>
<LoserPoints>4</LoserPoints>
<Ordinal>1</Ordinal>
</GameResult>
<GameResult>
<Id>4</Id>
<WinnerPoints>2</WinnerPoints>
<LoserPoints>6</LoserPoints>
<Ordinal>2</Ordinal>
</GameResult>
<GameResult>
<Id>5</Id>
<WinnerPoints>6</WinnerPoints>
<LoserPoints>1</LoserPoints>
<Ordinal>3</Ordinal>
</GameResult>
</MatchResult>
</FixtureResult>
這適合更多與列表比地圖 – Sandeep
你能發佈你的最佳嘗試在Java代碼? – Fildor