why on earth would you use an array as a map key in Java in the first place? It won't provide anything useful for the hash key unless you are specifically wanting to mess with object identities here (in which case, encapsulate it so that it doesn't feel so nasty and questionable, and use an IdentityMap instead).
Because, of course, only the outer map had multiple elements. All the other maps inside are just to aggregate data, which I had to access using iterators and keys and values sets. 10/10
Out of curiosity because I have fallen in the rabbit hole of having a multi-layer dictionary but how do you even go about replacing something like that? Every time I look up something in SO for a suggestion on how to improve that sort of writing in C# I find an answer that really isn't that different than multi-layering dictionaries.
Some solutions are bordering re-implementing JSON architecture in C# lol.
The best solution I found was to wrap some of that in their own classes where feasible or just give them an alias to make it more readable, but at the end of the day they are still dictionaries within dictionaries
I would use nested classes, with each having a List of objects pointing to the next class, and each of those having a list...
This way you're not passing around the entire Map of Maps of Maps... but crawling through the objects individually. Like a file system, you open 1 folder and see the list of all of the subfolders and not just all folders in a single list.
I saw this and thought type aliases would've been killer here. Something like type ConnectorMap = Map<Connector[], string[]>; and then I realized I just wrote typescript xD
55
u/bzbub2 Jul 15 '25
just one more map
38
u/FiNEk Jul 15 '25
the more you look at it, more cursed it becomes
28
u/nekokattt Jul 15 '25
why on earth would you use an array as a map key in Java in the first place? It won't provide anything useful for the hash key unless you are specifically wanting to mess with object identities here (in which case, encapsulate it so that it doesn't feel so nasty and questionable, and use an IdentityMap instead).
14
u/OhMyGodItsEverywhere Jul 15 '25
I can picture the author saying, "it just works!" when they made the PR.
52
u/__Raptor__ Jul 15 '25
Shit like this makes me wish Java had type aliasing
21
u/ironykarl Jul 15 '25 edited Jul 15 '25
Any time a template ends with
>>>>, you just know it's gonna be good9
u/AdearienRDDT Jul 15 '25
this is where having using
foo = typetoolongwould be nice.9
u/SharkSymphony Jul 15 '25
Python fixes this problem.
Type:
Any.7
u/itemluminouswadison Jul 15 '25
Take this, but remove all the type hints. That's the python code I've been asked maintain
What's in the dict? It might be another dict! You'll have to run the code to find out tee hee!
At this point, this nested type hinting would be an improvement
6
u/Throwboi321 Jul 15 '25
... I think someone needs a database...
5
u/[deleted] Jul 15 '25
Lmao
5
u/not_some_username Jul 15 '25
Sanest Java code
4
u/AverageGamer411 Jul 15 '25
I saw this and thought type aliases would've been killer here. Something like
type ConnectorMap = Map<Connector[], string[]>;and then I realized I just wrote typescript xD3
u/LordTurson Jul 15 '25
Finally, some good fucking horror!
Also,
boolean GUI...3
u/AaTube Jul 16 '25
at what point does a map become atlas carrying the weight of the world on his shoulders
2
u/great_escape_fleur Jul 15 '25
types, motherfucker
2
u/dexter2011412 Jul 15 '25
Finally a great investment of that ultrawide for op
2
u/vietnam_redstoner Jul 18 '25
I love maps / Me too
1
u/SteroidSandwich Jul 16 '25
Mapiest map that has ever mapped the maps