Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

synchronized linked list  RSS feed

 
James Kerruish
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using a linked list and I want to synchronize it. There doesn't appear to be a method synchronizedLinkedList() only synchronizedList(). Sun recommend doing something like:
List theList = Collections.synchronizedList(new LinkedList());
this would be fine but I use methods like theList.getFirst() and these are not avaiable in the basic List object. So basically I'm looking for a way of creating a synchronized LinkedList I was also wondering why this isn't available in the Collections class.
Thanks
 
David Weitzman
Ranch Hand
Posts: 1365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even if you don't like it, you should just deal with it. One of the side effects of abstraction is a more simple interface, but greater flexiblilty. The performence penalty for some extra checking is neglegable (particularly compared to the penalty for synchronization).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!