Home | Ajax | BioInformatics | Dojo | EAI | EJB | Hibernate | J2ME | Java | Java Glossary | Java Servlets | JavaScript | Jboss | JDBC | JDO | Jmeter | JSF | JSP | JUnit | Maven | MySQL | Spring Framework | SQL | Struts | Technology | WAP | Web Services | XML
 
 
Search All Tutorials

 
Programming Tutorials: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML
 
Java
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments

Java 6.0 Collection Framework

                         

 Some of the new collections APIs have been introduced in Java 6.0. These are:

  1. Deque: It is used to represent Double ended queue. With the help of this collection we can add or remove elements at both the ends. Deque implementation can be used as Stack (Last in first out) or Queue (First in First Out). There are two methods in Deque, which are used for insertion, retrieval and removal of elements. One returns status or special value for each operation and the other will throw exception if it fails in an operation.
  1. BlockingDeque: It is similar to Deque but with added functionality. When we try to insert an element in a BlockingDeque and if the BlockingDeque is already full then the element can wait till the space becomes available to insert an element. There are four methods available for BlockingDeque.
    • Methods throws exception
    • Methods that times out (Waits for a given time for space to available)
    • Methods that blocks (Waits indefinitely for space to available)
    • Methods returns special value
  1. NavigableSet: It is used to return the closest matches of elements. For instance if we want retrieve the element, which is immediately greater than, or lower than element 20 or if we want to retrieve all elements greater than or lower than 35 from sorted set elements [10,20,35,5] we can use NavigableSet methods that becomes just a method call. ConcurrentSkipListSet is one of the class that implements NavigableSet.
  1. NavigableMap: In NavigableSet, methods use to return values, but in NaviagableMap methods used to return the key,value pair. ConcurrentSkipListMap is the one of the class which implements NaviagableMap

Some of the new Classes are: 

  1. ArrayDeque: ArrayDeque is a class that implements Deque. If used as a stack or linked list, it performs much faster than before. It is neither thread safe nor has capacity restrictions.
  1. LinkedBlockingDeque: It implements BlockingDeque. Maximum capacity can be specified by using BlockingDeque interface. However the maximum capacity will be Integer.MAX_VALUE if not specified.
  1. ConcurrentSkipListSet: ConcurrentSkipListSet is one of the class that implements NavigableSet. It is used to return the closest matches of elements.
  1. ConcurrentSkipListMap: ConcurrentSkipListMap is the one of the class which implements NaviagableMap. In NavigableSet, methods use to return values.
  1. AbstractMap.SimpleEntry: The key value pair of one single entry in a Map is held by the instance of this class. Moreover it is a static nested class nested inside abstractMap class.
       
  2. AbstractMap.SimpleImmutableEntry: This class is similar to AbstractMap.SimpleEntry class however it has one difference that it throws the exception UnsupportedOperationException when we try to set a value while AbstractMap.SimpleEntry doesn’t.

Updated Classes in Java 6.0

  1.  LinkedList
     

  2. TreeSet
     

  3. TreeMap
     

  4. Collections

Modified classes                      

To implement the new interfaces we modify some classes like TreeSet is modified to implement NavigableSet, LinkedList is modified to implement Deque, TreeMap is modified to implement NavigableMap etc. Some of the new methods like newSetFromMap and asLifoQueue have been added to Collections 2.

 Hence the bi- directional traversal has become easier with java6.0 collections. We can even retrieve elements as desired.

                         

Facing Programming Problem?
Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

2 comments so far (post your own) View All Comments Latest 10 Comments:

please send me java source code of a scientific calculator and a text twist game....thank you...send to my email

Posted by Lovely on Friday, 04.4.08 @ 07:56am | #55278

i found to easy to read and understand the concept
clean without any doubt

Posted by chandrasekari on Monday, 01.7.08 @ 19:44pm | #44733

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Hot Web Programming Job

Java String toLowerCase Example
Java String toCharArray Example
Java String substring Example
Java String indexOf Example
Java String startsWith Example
Java String hashCode Example
Java String matches Example
Java String length Example
Java String lastIndexOf Example
Java String isEmpty Example
Java String equalsIgnoreCase Example
Java String equals Example
Java String endsWith Example
Java String copyValueOf Example
Java String contentEquals Example
  EAI Articles
  Java Certification
Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2007. All rights reserved.