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
any example of games that is created by java ?

Using this module we can keep up the database code clean and easy, and prevent problems that result from a failure to close database resources. A new layer of meaningful exceptions


Program 1. Write a Java program to display the first 20 Fibonacci numbers Program with Fibonacci sequence of first 20 terms Output 2. Write an applet progr

This assignment requires you to design, implement and test a program using Java features from the first half of the subject content. You are required to implement in Java all the c

Define Array ? Indexed collections of variable of similar data types or we can say a Set of organized variables of similar type.

We need a very good iOS and/or Android developer preferred to be from Egypt. He will be responsible in developing iOS or/ and Android apps for a company. All details will be provid

Question: (a) The following is a simple example of a Java Class: // File: Welcome.java public class Welcome { public static void main(String args[]) { System.out.printl

Describe about User Security Issues and Social Engineering ? Contrary to popular belief most computer break-ins through external hackers don't happen since of great knowledge

short Java application that stores words in an Array or ArrayList.