- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
And at the bottom of the article, I see "View all 0 comments". Oh, the irony.
Oh, and Frist BTW.
Admin
That's better than "View all 1 comments", which is what I see.
Admin
Dunno what you two are complaining about, "View all 2 comments" looked fine to me. You just need patience.
Admin
Dunno what you two are complaining about, "View all 2 comments" looked fine to me. You just need patience.
Admin
Oh good, I got my own TRWTF trying to comment, in which I got a "The CAPTCHA was not valid", so I resubmitted, but then it appears that both my comments are being held for moderation. Was it invalid or not?
Admin
Definitely done by an intern and never reviewed. This looks like code some of my 2nd or 3rd semester CS students might turn in.
Admin
My first assumption would be that the equals/hashCode contract on Deal is broken.
Admin
Maybe client.getSWMLs just returns all the SWMLs, and doesn't restrict it to the ones applicable to the list sent in. That would explain at least part of this code. There's no real excuse for iterating over the map though...
"Doesn't understand Map" is a much more believable explanation. I'd only agree with you if I knew the code was written by a skilful and well-informed colleague, and then I would be surprised and upset that they hadn't included a comment to explain this unexpected and dangerous situation.
Admin
"There's no real excuse for iterating over the map though".... I love edge cases [may not apply to the article, but does apply to the comment I quoted.... Depending on many factors such as the size of a map (or other keyed collection) and the position in the internal ordered array of values, it may be faster to iterate than to search.....
Admin
When you're getting to that point, chances are you'd be better off reassessing if a map is the best data structure for what you're trying to achieve.
Admin
That would take hard work to achieve. You'd have to make your own map implementation, and you'd have to write a truly insane lookup method inside it, such as randomly shuffling the map until the thing you want turns up at the front. In theory, someone might do that, but it's so much more work than just using one of the existing standard implementations (where lookup is faster than iterating) that it just wouldn't be something that you'd expect.
Admin
Reminds me of my old girlfriend, who in 1980 was working for Control Data. She was worrying about the speed of a loop in one program. It was looking up a user name in a list of about 12 names. In FORTRAN IV, no less. In case you are under 80 years old, FORTRAN IV did not really have character strings, but on a CDC computer your basic integer was 60 bits long, so you could pack ten 6-bit characters into one integer. User names were 7-characters max. So the search loop was very simple, something like: DO 99 I=1,12 $ IF( NAMETAB(I) .EQ. NUSERNAME ) GOTO 991$ 99 CONTINUE$ STOP 77$ 991 WRITE(6,*) 'LOGIN OKAY'
I think our relationship started going downhill right then, when I observed: "This code is run once a week. On the second-fastest computer in the world. About six instructions, which is enough to fit into the instruction cache. So at most about 10 instructions, at 100 nanoseconds each, one whole microsecond. Not a problem!"
Admin
If equals() in Deal is not symmetric, and the map is a LinkedHashMap, this may could be correct in a cursed way.
Admin
Yes you are right. <a href="https://www.houstonjackets.com/product/for-the-culture-crystal-hoodie-charcoal-grey