General Java Collections question

I don’t actually remember why I did this change,probably because of some stupid idea. Sync is never trivial, and I normally avoid implementations that need to sync. I tend to only use multi threading using a batch of job idea.

Started reading this thread.



Thought about Doug Lea.



Saw Doug Lea mentioned by @pspeed.



Books came into the conversation.



I decided that this applies. Read this book and java.util.concurrent’s beauty shines through. http://www.amazon.com/Java-Concurrency-Practice-Brian-Goetz/dp/0321349601

1 Like

@t0neg0d

Hey, if you like Lovecraft you probably will like (love) a horror short story paperback I read about 20 years ago in my early twenties, called Carnaki, the Ghost-Finder. Written by William Hope Hodgson (Wikipedia link) in 1913 and published in 1947.



The book has 9 short stories and at the time I could NOT turn off my bedroom’s lamp after finishing stories #4 and #9, mostly #9. And that was with the translated French version. I can’t imagine how scary it could be in English.

I have to say I wasn’t that impressed by Lovecraft. Some nice ideas but I found that rather than actually being scary he just said that something was scary and expected the reader to be scared. i.e. rather than describing the mountains and evoking fear through the description he just said the mountains were scary and expected me to oblige by being scared…

I remember watching a film many years ago - “To cast a deadly spell”…Cthulhu/40s detective crossover. It was good at the time although I’ve no idea how well it has stood the test of time…



…and Chrome loses points to firefox as it doesn’t know how to spell Cthulhu :frowning:

lol…there should be something like the Godwin’s law…but with Cthulhu instead of Hitler.

Thulium(german dictionary) … well ok opera does not seem to understand Cathlene(english one)… losses points to firefox as well :stuck_out_tongue:

i’ll maybe say something stupid, but you have the class Collections which has methods :

synchronizedXXX

where XXX is : Collection, List, Map, Set, SortedMap, SortedSet.



I don’t know if it’s fast or not, but as long as it’s the real synchronized class is created in a method (YOU do not do a “new”) i think that people who develop java gave the best implementation for this.



I can also remember you :

“The First Rule of Program Optimization: Don’t do it. The Second Rule of Program Optimization (for experts only!): Don’t do it yet.”

(Michael A. Jackson)



You still can create your own custom class which (in the first tim) will just use the Collections’s methods and later improve it if your game is too slow. But if your game is slow, it’s very likely that it won’t be because of that.

@bubuche said:
i'll maybe say something stupid, but you have the class Collections which has methods :
synchronizedXXX
where XXX is : Collection, List, Map, Set, SortedMap, SortedSet.


These are the old ancient classes. java.util.concurrent classes are the new better classes that are superior in nearly every way.

On a team, when I see a developer use Collections.synchronizedXXX() methods then I automatically assume they don't know much about threading and so I look at rewriting all of their threading stuff.