EnumMap 클래스는 자바 5에서 추가된 내용이므로 새로울지 모르나 저번 강의시간에 열거셋에 대해서 이미 공부하였으므로 필자의 핵심예제를 통해 바로 습득하는 시간을 가져보겠다.^^
=== 강이의 JAVA강좌 ===
Map: {SUNDAY=S, MONDAY=M, TUESDAY=T, WEDNESDAY=W, THURSDAY=T, FRIDAY=F, SATURDAY=S}
Key: [SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY]
Value: [S, M, T, W, T, F, S]
예제를 간략하게 보면 오늘 출력하는 부분은 총 3가지로 이루어져 있다. 하나는 키와 밸류를 함께 출력하는 Map이고 다른 하나는 키만 출력하는 Key이고 나머지 하나는 밸류만 출력하는 Value이다. 예제는 거부감(?)을 없애기 위해 예전에 썼던 Day 열거형을 사용하였으니 금방 예제에 동화(?)되리라 본다.ㅎㅎ
열거맵이므로 열거형을 사용하며 예제에서는 그로 Day를 만들어서 사용하였다. 열거맵을 사용하려면 열거셋과 마찬가지로 열거형이름에 확장자로 class를 명명하면 열거형에 있는 요소들을 해당맵의 key로서 사용이 가능해진다. 우리는 열거맵을 공부하고 있으므로 이 열거요소들, 즉 키에 해당하는 각각의 밸류값들을 put( ) 메소드를 통해 넣어주었다.^^
다음 단락은 그렇게 고생고생(?)해서 만든 열거맵을 찍어주는 구문이다. 이제 이런 메소드들은 해보기도 하였지만 보기만봐도 다 이해가 될것이다. 그 이유중 하나는 필자가 이미 언급하였다시피 자바 컬렉션 프레임워크의 메소드들은 기능에 의미를 부여함은 물론 여러 컬렉션 클래스들에서 그 기능이 같거나 비슷할경우 해당 메소드 이름도 같거나 비슷하게 지었기 때문에 아주 생소한 이름이 아닌이상 의미파악이 어느정도 가능하기 때문에 그러하다.^^
끝으로 한마디 덧붙이자면 자바의 열거맵(EnumMap)은 비동기화(not synchronized) 되어있고 물론 Collections.synchronizedMap( ) 메소드를 이용하면 동기화 가능하고 반복자는 fail-fast 방식이고 열거맵의 순서는 열거형의 키를 기반으로 자연적인 순서(natural order)를 따른다. 여기서 자연적인 순서라함은 enum Day에서 열거한 순서대로 나열한다는 것을 말한다. 예를 들어, enum DAY에서 열거요소의 SUNDAY와 MONDAY를 바꿔놓으면 모든 결과들은 이 둘의 순서가 뒤바뀌어서 출력될 것이다. 여러분이 put( ) 메소드를 이용해서 밸류값을 넣은 순서와 상관없이 말이다.ㅎㅎ 그냥 그렇구나하고 넘어가지 말고 직접 해보면서 알아가는 여러분이 되기 바란다. 복습 잘하기 바라면서 열거맵 강좌는 여기서 마무리하겠다.^^
좋은 강의 항상 잘 읽고 있습니다.
답글삭제감사합니다.
Excellent blog! Do you have any hints for aspiring writers?
답글삭제I'm planning to start my own blog soon but I'm a little lost on everything.
Would you recommend starting with a free platform like Wordpress or go for a paid option?
There are so many choices out there that I'm completely confused .. Any recommendations? Bless you!
Here is my webpage :: free chat rooms no registration
you're in point of fact a good webmaster. The site loading speed is amazing. It kind of feels that you're doing any distinctive
답글삭제trick. In addition, The contents are masterwork. you've done a wonderful job in this matter!
Feel free to visit my homepage ... free ps3 games
That's where the aurawave and its might as a TENS hurting backup can assist the physical structure to dismission lifelike" painkillers" called endorphins, which helps the mentality delivery some lifelike hurting ease has several advantages. Annoyance interferes with our power to bouncy a normal modus vivendi, and since and then, the grocery, but the aurawave delivers.
답글삭제Also see my site :: http://aurawavereview.com/
Hey just wanted to give you a quick heads up. The text in your post seem to be running off
답글삭제the screen in Ie. I'm not sure if this is a formatting issue or something to do with internet browser compatibility but I figured I'd post to let you know.
The style and design look great though! Hope you get the issue resolved soon.
Thanks
Also visit my web site Online Casino
I really like your blog.. very nice colors & theme.
답글삭제Did you design this website yourself or did you hire someone to do it for you?
Plz respond as I'm looking to create my own blog and would like to know where u got this from. thanks
my blog The best natural cure for gynecomastiaand how it functions
Fundamentally the flеx belt is а belt you strap on aгоunԁ уour waist and three partiсularly placеd рaԁs are what suρροrt cοntrаct your abѕ.
답글삭제Hеre is my ωeb-sitе Flex belt reviews
Hi, i think that i ѕaω yοu νisіted my ωeb site thus i cаme to “return
답글삭제the faѵor”.I'm trying to find things to improve my site!I suppose its ok to use some of your ideas!!
Feel free to visit my website - Payday Loans
hello there and thank you for your information – I've definitely picked up something new from right here. I did however expertise some technical issues using this website, as I experienced to reload the website many times previous to I could get it to load correctly. I had been wondering if your web hosting is OK? Not that I am complaining, but sluggish loading instances times will often affect your placement in google and can damage your high quality score if advertising and marketing with Adwords. Well I am adding this RSS to my email and can look out for much more of your respective intriguing content. Make sure you update this again very soon.
답글삭제Also visit my webpage - goedkope vliegtickets
안녕하세요, 위키독스(wikidocs.net)를 운영하는 박응용이라고 합니다. 블로그에 연재중이신 Java 강좌를 전자책으로 출간하는 것에 대해서 문의드리고 싶습니다. 관심있으시다면 아래 이메일로 연락주시면 감사하겠습니다.
답글삭제pahkey@gmail.com
If you don't like soft drinks or any drinks containing sugar or
답글삭제sweeteners you have 41% more chances to lose weight than those that do.
No one wants to be out of shape for pool and beach season,
yet every year I've noticed that most people are. This is because the less you weigh the fewer calories
it takes to function.
Here is my page :: weigh loss
This piece of writing will assist the internet people for setting up new blog or even a weblog from start
답글삭제to end.
Also visit my website: az dui attorney
Hi! Do you use Twitter? I'd like to follow you if that would be okay.
답글삭제I'm undoubtedly enjoying your blog and look forward to new updates.
Also visit my weblog - Temp Job Agencies Los Angeles
Heya i am for the primary time here. I came across this board and I in finding It truly helpful & it helped me out much.
답글삭제I am hoping to offer something back and help others like you
aided me.
Take a look at my homepage - phoenix az criminal attorney
I need to to thank you for this very good read!!
답글삭제I absolutely loved every bit of it. I've got you saved as
a favorite to look at new things you post…
Also visit my web page car lawyer
great publish, very informative. I ponder why the opposite experts of this sector do not realize this.
답글삭제You must proceed your writing. I am sure, you have a huge
readers' base already!
my blog post - tampa car accident
Hi there, I found your site by means of Google whilst looking for
답글삭제a comparable matter, your web site came up, it appears good.
I have bookmarked it in my google bookmarks.
Hi there, just turned into aware of your weblog thru Google, and found that it is truly informative.
I'm going to be careful for brussels. I will be grateful
when you proceed this in future. Numerous people will probably be benefited out of your writing.
Cheers!
Also visit my web-site: car accident lawyer tampa
Hey would you mind sharing which blog platform you're
답글삭제using? I'm looking to start my own blog soon but I'm having a hard
time making a decision between BlogEngine/Wordpress/B2evolution and Drupal.
The reason I ask is because your design and style seems different then most blogs and I'm looking for something unique.
P.S My apologies for being off-topic but I
had to ask!
Look into my web-site: car accident lawyer tampa
First of all I would like to say terrific blog! I had a
답글삭제quick question in which I'd like to ask if you do
not mind. I was curious to know how you center yourself and clear your head before writing.
I've had difficulty clearing my thoughts in getting my ideas out there.
I truly do enjoy writing but it just seems like the first 10 to 15
minutes tend to be wasted just trying to figure out how to begin. Any
ideas or hints? Thanks!
My web site book of ra deluxe games ()
와.. 정말 공부하는데 도움이 되는 주옥같은 강의네요.
답글삭제개인적으로 연락좀 하고싶은데 혹시 이 댓글 보신다면
lindomain@nate.com 네이트 친추좀 부탁드릴게요.