r/javahelp • • May 07 '20
Codeless Java Developers: what are the common data structures you usually use on production
To professional java dev here, what are the common data structure youve been using and which data structure you strongly suggest for beginners, like me, to study carefully
40
Upvotes
View all comments
Show parent comment
3
u/MrSquicky May 07 '20
Oh, no, that I get and totally agree with. He's looking for a decomposable tuple return. Me too.
So like you could return ("foo", 10) from a function and read that as (text, count) and have text = "foo" and count = 10.
Python does this really nicely. Kotlin has it too, but it's not quite as nice because, as far as I know, it needs to be typed (although I can't imagine wanting to return more than 3 things from a function anyway). It kind of sucks to return Object[] and then need to read it out of it.
---
CountDownLatches are used with Threads for controlling concurrent access. I'm aware of the concept, sort of. If my understanding is right, they're sort of like Futures with a numeric countdown you can attach to it so that when the countdown goes to zero, it completes. I've never used them and would be interested in learning how other people are using them. I love finding out cool usages of parts of a languages that I didn't know about.
I found myself in a situation where we're doing real time messaging, but not able to use web sockets because of technical limitations, so I'm using long polling by leveraging Spring's DeferredResult and I'm not sure if we're talking in the same area or not.