Describe the java collections framework? , JAVA Programming

Comparable interface: The "Comparable" allows itself to compare with other same types of object. The function compareTo() is specified in the interface.

Several of the standard classes in the Java library like String, Date, Integer, File etc implement the Comparable interface to provide the class a "Natural Ordering".

 For example String class describes the following methods:

public int compareTo(o)

public int compareToIgnoreCase(str)

 

Comparator interface: The Comparator is needed to compare two distinct objects. The following function is specified in the Comparator interface.

public int compare(Object l1, Object l2)

 

606_Untitled.png

 

 

There are the benefits of the Java Collections Framework.

Java Collections framework gives performance, flexibility, and robustness.

1. Polymorphic algorithms - sorting, binary search, reversing, shuffling etc.

2. Set algebra - such as finding subsets, unions, and intersections between objects.

3. Performance - collections have much better performance compared to the Hashtable classes and older Vector with the elimination of synchronization overheads.

4. Thread-safety - when synchronization is needed, wrapper implementations are gives for temporarily synchronizing existing collection objects.

5. Immutability - when immutability is needed wrapper implementations are given for building a collection immutable.

6. Extensibility - abstract classes and interfaces give an excellent starting point for adding functionality and features to prepare specialized object collections.

 

Posted Date: 7/25/2012 1:32:11 AM | Location : United States







Related Discussions:- Describe the java collections framework? , Assignment Help, Ask Question on Describe the java collections framework? , Get Answer, Expert's Help, Describe the java collections framework? Discussions

Write discussion on Describe the java collections framework?
Your posts are moderated
Related Questions

Question: (a) What are the main differences between an object and a class? Illustrate with appropriate examples. (b) Differentiate between a global variable and a local va

Are constructors inherited ? Can a subclass call the parent class constructor and When?

Normal 0 false false false EN-US X-NONE X-NONE

The IncludeAction class is useful when you require to integrate Struts into an application that uses Servlets. Use the IncludeAction class to contain another resource in the respon

The more complicated the underlying system, the more critical the inter communication among everyone involved in deploying and developing the software. UML is a software language f

Hello, My friend Roshan from India told me that you provide a high quality programming service which is why I''m here. I would like you to make a clone of an android app the app

The "http protocol" is a stateless response or request based protocol. You may contain the state information between different page requests as given below: HTTP Sessions are

Give the example of mixing data type in java? Mixing Data Types Order can form a difference while data types are mixed. For example, 1 / 2 * 3.5 = 0.0 3.5 * 1 / 2 = 1.75 3.5 /

What is PortableRemoteObject.narrow() method and what is used for?                Ans) Java RMI-IIOP gives a mechanism to narrow the the Object you have received from from your