• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regarding Collections

 
Mani Venkata Kanth
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

pls...Anybody will summarize which collection should be used for the given
requirements
.???

Thanks for your replies
 
Praveen Babu
Ranch Hand
Posts: 138
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, what are the requirements ?
 
Shaan Shar
Ranch Hand
Posts: 1249
Java Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by k pandu:
hi,

pls...Anybody will summarize which collection should be used for the given .???

Thanks for your replies


This seems to be a homework.. You tell us what are your requirements, then we may provide you the Optimum way out.. But if you are asking in General. Then you should first read out the Collection ownself..

Check out this link to get hands-on on Collection


1. Java Collection

2. Core JAVA Collections

3. Performance of Collections

Hope this helps you.
 
Mani Venkata Kanth
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
which collections are suitable for the following requirements...

1.for uniqueness and sorted order
2.for uniqueness and unsorted order
3.duplicates with sorted order
4.duplicates with unsorted order
 
Shaan Shar
Ranch Hand
Posts: 1249
Java Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by k pandu:
which collections are suitable for the following requirements...

1.for uniqueness and sorted order
2.for uniqueness and unsorted order
3.duplicates with sorted order
4.duplicates with unsorted order


Seems to be a homework exercise.. At every page of Collections they have clearly mentioned which to be use according to condition given by you...

Take a look on the links I have mentioned for you..... There you will be get clear picture.
 
aparna maddukuri
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this might solves u'r doubt

1.for uniqueness and sorted order-TreeSet
2.for uniqueness and unsorted order-HashSet
3.duplicates with sorted order-ArrayList
4.duplicates with unsorted order-LinkedList
 
bing marquez
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I think this might solves u'r doubt

1.for uniqueness and sorted order-TreeSet
2.for uniqueness and unsorted order-HashSet
3.duplicates with sorted order-ArrayList
4.duplicates with unsorted order-LinkedList


The elements of an ArrayList are ordered by their index, they are not however sorted.
 
aparna maddukuri
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I too a bit confused in writing.
what was the best collection suits for "duplicates with sorted order".
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic