This post originated from an RSS feed registered with Java Buzz
by dion.
Original Post: Concurrency and list.getLast()
Feed Title: techno.blog(Dion)
Feed URL: http://feeds.feedburner.com/dion
Feed Description: blogging about life the universe and everything tech
Brian Goetz (Mr Concurrency) has finished Java Concurrency in Practice a book in which he has sweat blood and tears for sure.
If you mention anything to him right now he will immediately be able to tell you about the concurrency issues and how we have multicores now, and hence we will soon be screwed.
Someone was complaining about list.getLast() instead of list.get(list.size()-1)
Brian pointed out that this isn't about ease of use, but that (of course):
list.getLast() would be atomic, whereas list.get(list.size()-1) would
not, and could throw NPE even for a nonempty list if a list element were
removed by another thread at just the wrong time.
I had preordered the book on Bruce's recommendation. Just got it a week or so ago and it is superb. Very readable. You could almost forget the highlighter since almost everything would be yellow (green, whatever).