EDIT: I think I understand what you're saying. The upper bound is anything greater than O(n), but it doesn't necessarily mean it does take that long. Not sure how helpful it is to see it this way though.
The missing piece for me was that "makes it" doesn't mean it's the same as, but rather a subset of. It doesn't mean that it will take n2 iterations, it just means that mathematically one is a susbet of the other.
4
u/Masynchin Aug 26 '22
What is this theme?
296
u/aneeshak Aug 26 '22
Team lead to intern: change this list comparison to a map for faster execution .
Intern: sure boss!
167
u/thefriedel Aug 26 '22
Not even a 'break;' if something is found, just pointlessly iterate over the rest of the HashMap
59
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Aug 26 '22
Image Transcription: Code
I'm a human volunteer content transcriber and you could be too! If you'd like more information on what we do and why we do it, click here!
54
u/youngbull Aug 26 '22
Naming the entry variable set fried my brain. For those who want to understand what is going on without requiring brain surgery:
109
u/wknight8111 Aug 26 '22
"Iterating over a hashmap is like killing a fly with a bazooka"
I can't remember who said that, I thought it was Larry Wall but I can't find a citation right now.
14
u/loomynartylenny Aug 26 '22
At least use a
LinkedHashMapsmh my head8
u/digital808music Aug 26 '22
What language is this I can’t read it.
15
u/Accidentallygolden Aug 26 '22
But is it faster?
5
u/[deleted] Aug 26 '22
Brilliant!
5
u/[deleted] Aug 26 '22
This is wrong on so many levels
5
u/doctorcheto Aug 27 '22
Can someone explain what’s bad about this? Is it because you can just get the value using the key, without needing to iterate over it?
4
u/donszymon Aug 26 '22
Anyone knows what is this font?
3
u/oli-capybara Aug 26 '22
it's like... half understood lol it's kinda funny
2
u/cheezballs Aug 27 '22
Dude, this is the kinda code I've written in the 13th hour and my brain is beyond fried.
2
u/[deleted] Sep 24 '22
Drugs are bad, m’kay…..
3
u/[deleted] Aug 26 '22
I give you one better: why is a map?
1
u/freakinginsane Aug 27 '22
Which font is that?
1
u/[deleted] Aug 27 '22
What language is this again?
1
u/Ishax Sep 19 '22
For a moment I thought this was using a higher order map function, and a for loop to do the same thing. The joke was funnier then.
1
u/Brelee2222 Oct 01 '22
Array but values instead of indexes
1
u/bravopapa99 Oct 30 '22
What do Java programmers do again ?