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
1. The spring container searches the bean's definition from the XML file and instantiates the bean. 2. Using the dependency injection, spring populates all of the properties as

A bean factory is fine to easy applications, but to take benefit of the full power of the Spring framework, you may require to move up to Springs more advanced container, the appli

The Application context module makes spring a framework. This module extends the concept of BeanFactory, giving support for internationalization (I18N) messages, application lifecy

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

using polymorphism to write a program to display digital clock

1. RUP is relying on a few important principles and philosophies like planning ahead, knowing where the process is capturing and heading the project in extensible and storable mann

Translate Four Row Solitaires from Java Swing to Android. Project Description: There is a product known Four Row Solitaire listed in GitHub. I would like Swing GUI to be repl

We have to create a world class that contains a 2d array then create an abstract class called organism that contains move() method the organism should move randomly one step at the

What is a variable in Java program? It's a memory location. Memory location is given some name. Memory location is being assigned some value. Value may change o

How does JVm do dynamic checking The JVM also does "dynamic" checking at runtime for certain operations, like pointer and array access, to make sure they are touching only memo