4 ms·
Correct me if I am wrong, isn't a channel basically same as blocking queues in Java? I know go but not much advanced.
by chakkepolja 5y ago
Correct me if I am wrong, isn't a channel basically same as blocking queues in Java? I know go but not much advanced.
- eitland 5y agoSeems like there are a few differences but nothing I personally would leave normal indexing, kind of working generics, Maven and a choice of 3 world class IDEs behind for: https://stackoverflow.com/questions/10690403/go-channel-vs-java-blockingqueue https://stackoverflow.com/questions/10690403/go-channel-vs-j... To each their own though. I hear a lot of people prefer it.
- clipradiowallet 5y agoI don't code Java, but I have the same sentiment about channels in golang to queue's in python.
- boyter 5y agoMore or less, but with the ability to "poison" them by closing which causes downstream go-routines to exit. You can do the same thing in java by checking for a poison object and then terminate your loop. The close is built into the language itself which is useful, along with the other built in language functionality. I wrote about it here, with an example of how to do it https://boyter.org/posts/file-read-challange/ https://boyter.org/posts/file-read-challange/
- chakkepolja 5y agoThanks!