Solved

java collection resources

Posted on 2013-12-09
7
802 Views
Last Modified: 2013-12-12
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
0
Comment
Question by:gudii9
  • 4
  • 3
7 Comments
 
LVL 35

Expert Comment

by:mccarl
Comment Utility
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!
0
 
LVL 7

Author Comment

by:gudii9
Comment Utility
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
0
 
LVL 35

Expert Comment

by:mccarl
Comment Utility
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!
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 7

Author Comment

by:gudii9
Comment Utility
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
0
 
LVL 35

Expert Comment

by:mccarl
Comment Utility
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.
0
 
LVL 7

Author Comment

by:gudii9
Comment Utility
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
0
 
LVL 35

Accepted Solution

by:
mccarl earned 500 total points
Comment Utility
is Deque is new addition with javaSE6 or 7.
If you check out the Javadoc...

http://docs.oracle.com/javase/7/docs/api/java/util/Deque.html

...just above the "Method Summary" it states "Since 1.6", so yes, it's new is Java 6


What is meaning of double ended queue and how to relate with Bank example
Pretty well covered above I thought, but anyway... by "double ended queue" it just meaning that the adding/removing operations can happen at BOTH the head of the queue AND at the tail of the queue. In terms of the bank example, as I said you normally add items/people to the tail end of the queue, and the bank teller gets the next item/person from the head of the queue. With double ended queues, because we can do both adding and removing of items/people at both the tail and head of queue, we can do the normal case of the bank queue above, but we could also say, if we get a VIP customer, we could add them to the head of the queue rather than the tail, so that they get served faster. Just as an example.


What you mean by either. please advise
By "either", I meant either of the two use cases that I had just been describing, ie. A Deque allows you to implement either a "stack" or a "queue" just by using the different methods that it provides.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now