6. 4 Maps.pdf - JTb JT MQi?2` 7mM/K2MiH QHH2 iBQM ivT2...

  • No School
  • AA 1
  • 15

This preview shows page 1 - 6 out of 15 pages.

J<Tb
Image of page 1
J<T ;MQi?2` 7mM/<K2Mi<H +QHH2+iBQM ivT2 Bb i?2 K<T X ; K<T Q7 ivT2 Map[Key, Value] Bb < /<i< bi`m+im`2 i?<i <bbQ+B<i2b F2vb Q7 ivT2 Key rBi? p<Hm2b Q7 ivT2 Value X 1t<KTH2b, val romanNumerals = Map( ŏIŏ -> 1, ŏVŏ -> 5, ŏXŏ -> 10) val capitalOfCountry = Map( ŏUSŏ -> ŏWashingtonŏ , ŏSwitzerlandŏ -> ŏBernŏ )
Image of page 2
J<Tb <`2 Ai2`<#H2b *H<bb Map[Key, Value] 2ti2M/b i?2 +QHH2+iBQM ivT2 Iterable[(Key, Value)] X h?2`27Q`2- K<Tb bmTTQ`i i?2 b<K2 +QHH2+iBQM QT2`<iBQMb <b Qi?2` Bi2`<#H2b /QX 1t<KTH2, val countryOfCapital = capitalOfCountry map { case (x, y) => (y, x) } //!Map(ŏWashingtonŏ ->!ŏUSŏ,!ŏBernŏ ->!ŏSwitzerlandŏ) LQi2 i?<i K<Tb 2ti2M/ Bi2`<#H2b Q7 F2vfp<Hm2 T<B`b X AM 7<+i- i?2 bvMi<t key!->!value Bb Dmbi <M <Hi2`M<iBp2 r<v iQ r`Bi2 i?2 T<B` (key, value) X
Image of page 3
J<Tb <`2 6mM+iBQMb *H<bb Map[Key, Value] <HbQ 2ti2M/b i?2 7mM+iBQM ivT2 Key!=>!Value - bQ K<Tb +<M #2 mb2/ 2p2`vr?2`2 7mM+iBQMb +<MX AM T<`iB+mH<`- K<Tb +<M #2 <TTHB2/ iQ F2v <`=mK2Mib, capitalOfCountry( ŏUSŏ ) //!ŏWashingtonŏ
Image of page 4
Zm2`vBM= J<T ;TTHvBM= < K<T iQ < [email protected]= F2v =Bp2b <M 2``Q`, capitalOfCountry( ŏAndorraŏ ) //!java.util.NoSuchElementException:!key!not!found:!Andorra hQ [m2`v < K<T rBi?Qmi FMQrBM= #27Q`2?<M/ r?2i?2` Bi +QMi<BMb < =Bp2M F2v- vQm +<M mb2 i?2 get QT2`<iBQM,
Image of page 5
Image of page 6

You've reached the end of your free preview.

Want to read all 15 pages?

  • Fall '19

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors