Link to home
Start Free TrialLog in
Avatar of gudii9
gudii9Flag for United States of America

asked on

java collection resources

Hi,

i am not very sound with java collection concepts how to store, retrieve complex business objects used in various client projects. How do I improve in that area.

please advise
Any links,sample code, resources ideas highly appreciated. Thanks in advance
Avatar of mccarl
mccarl
Flag of Australia image

java collection concepts how to store, retrieve complex business objects
Are you talking about "collection concepts" in terms of Java's List, Map, Set, etc? If so, then fortunately it doesn't actually matter much whether you are talking about simple objects or complex business objects, the way you use these interfaces and their implementation classes are essentially the same. So learning about the uses of these with simple objects, such as String, Integer, etc. is the first step and then you should be able to easily apply this to your complex business objects.

It is hard for us to know what level you are currently at so I can say how appropriate this is but as a first step, I would check out the Java Tutorials on Collections (http://docs.oracle.com/javase/tutorial/collections/)

If you can explain in a bit more detail about what you are having trouble with, we can certainly provide more appropriate help to you!
Avatar of gudii9

ASKER

Sure. Will check that.

I am curious to know master collection concepts as a whole. I would say I am at intermediate level.

 I want some site which i can refer for 5-10 min and should be able to refresh all the concepts of collection at a glance.

I checked this link but not much of java resources here.
http://www.javacodegeeks.com/2013/01/15-online-learning-websites-that-you-should-check-out.html

Please advise
I want some site which i can refer for 5-10 min and should be able to refresh all the concepts of collection at a glance.
I'm pretty sure that the link I gave will give you that (or pretty close). Did you look at the "Interfaces" page in particular? I don't think you will get any more "at a glance" than that!
Avatar of gudii9

ASKER

I am going through it. I read as below

Deque — a collection used to hold multiple elements prior to processing. Besides basic Collection operations, a Deque provides additional insertion, extraction, and inspection operations.

Deques can be used both as FIFO (first-in, first-out) and LIFO (last-in, first-out). In a deque all new elements can be inserted, retrieved and removed at both ends. Also see The Deque Interface section

What is this Deque. i am reading and hearing for the first time.
Sorted sets are used for naturally ordered sets, such as word lists and membership rolls

Sorted maps are used for naturally ordered collections of key/value pairs, such as dictionaries and telephone directories.

what is the meaning of the naturally ordered.

 Please advise
What is this Deque
What you quoted above does a pretty good job of explaining. But basically it is a "double ended queue", and by this is means that the queueing operations (adding items to the queue and removing items from the queue) can be made to operate on "either" end of the queue. This allows for a couple of different use cases...

A "stack" of items can be created. Think about a "stack" of papers on a desk, where you put new papers on the top of the stack and when you need to do something with one of them, you take the top one, ie. you are always operating on the top of the stack, you never add or take from the bottom of the pile.

A "queue" of items can be created. Like at a bank, you join the end of the queue and you wait as you move forward in the queue until eventually you are at the head of the queue and that is where the bank teller takes the next customer from. So you are adding items to the end (or tail) of the queue and taking the next one from the head of the queue.

A Deque basically allows you to do either (and even both at the same time if need be) by calling different methods. If you look through the Javadoc you will see all the different methods for operating on either end of the Deque.


what is the meaning of the naturally ordered.
Naturally ordered is just the default ordering for a particular object. For instance, the natural order for a sorted collection of Strings is "alphabetical" order, and for a sorted collection of Integers is "numerical" order. Some classes don't have a "natural order" at all. As an example, consider a Point2D class that represents a point in 2 dimensional space, as x and y coordinates. There is no natural order to these objects, you can't just say order them by their x coordinate, because ordering them by their y coordinate is just as valid or even ordering them by their distance to the origin. They are all valid orderings by neither is considering "natural" or the default one.

The quotes that you pulled out about the sorted collections are not totally correct. Because SortedSets and SortedMaps can be used for both naturally ordered collection as well as "arbitrarily" ordered collections by providing a Comparator instance that explicitly defines the desired ordering. You probably don't have to worry too much about this though, but I am just highlighting the point.
Avatar of gudii9

ASKER

is Deque is new addition with javaSE6 or 7.

I got what is stacka and queue.

What is meaning of double ended queue and how to relate with Bank example

A Deque basically allows you to do either

What you mean by either. please advise
ASKER CERTIFIED SOLUTION
Avatar of mccarl
mccarl
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial