2

Greetings,

I've been working out of an embedded version of Java where the height of complex structures included in the API was a vector or queue. This usually meant writing structures from scratch when needed.

I am now coming back to the land of the living, I will have full access to a real version of java with all the bells and whistles. This however presents a new problem, the API is quite large.

I was wondering if anyone could tel me about essential data structures which have come to existence in the last 2 years. I'm talking about lists, maps, tree's etc. structures that can handle concurrency and structures.

From what I remember there was a concurrency library however some standard collection structures also had concurrency aspects put in place.

2 Answers 2

8

Start with the Java Collections Trail

http://java.sun.com/docs/books/tutorial/collections/index.html

This will go over all of the basics.

Then once you're happy take a look at the Concurrent Collections Trail

http://java.sun.com/docs/books/tutorial/essential/concurrency/collections.html

However it would also be a good idea to look at the Concurrency package as well.

Sign up to request clarification or add additional context in comments.

Comments

1

pre java 1.4 you had Collections with synchronised way of thread control, then from java 1.5 lots of concurrent collections where added. Use of right collection will benefit your application in both performance and and lesser usage of memory. eg.

Synchronised

  1. Vector
  2. HashMap
  3. HashSet

Concurrent

  1. CopyOnwriteArrayList
  2. ConcurrentHashMap
  3. ConcurrentHashSet
  4. ArrayBlockingQueue etc.

You can make any collection synchronize by saying declaring

Collections.synchronizedCollection(c);

Again unnecessary use of concurrent/synchronised will give your app performance hit.

links given by pjp gr8 http://java.sun.com/docs/books/tutorial/collections/index.html http://java.sun.com/docs/books/tutorial/essential/concurrency/collections.html

One you are through with all these collection go through with different opensource collection like

guava library by Google http://code.google.com/p/google-collections/

Commons Collections http://commons.apache.org/proper/commons-collections/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.