首先,我非常新的C#即時通訊嘗試重新創建一個我用Java創建的應用程序。鏈接4列表框
我有4個Listboxes。每個框將保存來自xml文件的值列表。
listBox_year爲<Year>
。 listBox_make爲<Make>
。 listBox_model爲<Model>
。 listBox_subModel用於<sub-Model>
。
因此,讓我說我把所有的年份添加到listBox_year沒有重複的年份。假設我點擊一年,它會提出當年所有的汽車製造商。然後我點擊Make,它會調出那個在那年製作的模型等等......
用Java我能夠使用HashMap來使這個工作到我可以有多個鍵的地方相同的名稱,我可以搜索在這種情況下,選擇年份的關鍵字抓取所有以該年爲關鍵字的「所有」或「值」。
下面是XML格式
<?xml version="1.0" encoding="utf-8" ?>
<vehicles>
<Manufacturer>
<Make>Subaru</Make>
<Year>2010</Year>
<Model>Impreza</Model>
<Sub-Model>2.0i</Sub-Model>
<Highway>36 MPG highway</Highway>
<City>27 MPG city</City>
<Price>$17,495</Price>
<Description>
Symmetrical All-Wheel Drive.
SUBARU BOXER® engine.
Seven airbags standard.
>Vehicle Dynamics Control (VDC).
</Description>
</Manufacturer>
<Manufacturer>
<Make>Toyota</Make>
<Year>2012</Year>
<Model>Supra</Model>
<Sub-Model>TT</Sub-Model>
<Highway>22 MPG highway</Highway>
<City>19 MPG city</City>
<Price>$48,795</Price>
<Description>
16-inch aluminum-alloy wheels.
6-speaker audio system w/iPod® control.
Bluetooth® hands-free phone and audio.
Available power moonroof.
</Description>
</Manufacturer>
<Manufacturer>
<Make>Subaru</Make>
<Year>2011</Year>
<Model>Impreza</Model>
<Sub-Model>2.0i Limited</Sub-Model>
<Highway>36 MPG highway</Highway>
<City>27 MPG city</City>
<Price>$18,795</Price>
<Description>
16-inch aluminum-alloy wheels.
6-speaker audio system w/iPod® control.
Bluetooth® hands-free phone and audio.
Available power moonroof.
</Description>
</Manufacturer>
<Manufacturer>
<Make>Subaru</Make>
<Year>2011</Year>
<Model>Impreza</Model>
<Sub-Model>2.0i Limited</Sub-Model>
<Highway>36 MPG highway</Highway>
<City>27 MPG city</City>
<Price>$18,795</Price>
<Description>
16-inch aluminum-alloy wheels.
6-speaker audio system w/iPod® control.
Bluetooth® hands-free phone and audio.
Available power moonroof.
</Description>
</Manufacturer>
</vehicles>
您的問題是什麼?你在找'Dictionary'嗎? – SLaks
即時通訊不知道該集合被稱爲,但似乎@lcfseth很快回答了這個問題。 –