Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the spectra-pro domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home4/mahidhar/public_html/wp-includes/functions.php on line 6114
Java Collections | tutorialQ

Java Collections

About Collections Framework:

Collections are used to store, retrieve, manipulate, and communicate aggregate data. Collections represent data items that form a natural group, such as list of students, telephone directory etc.,

Java collections framework is a collection of interfaces and classes which helps in storing and processing the data efficiently.

The collections framework defines several interfaces. This section provides an overview of some of the important interfaces provided by Collections framework :

Collections Interface

Top of collections Hierarchy. This interface is the foundation to the entire collections framework which lists all the methods implemented by other classes.

List Interface

This extends Collection and an instance of List stores an ordered collection of elements.

Set Interface

This extends Collection to handle sets, which must contain unique elements.

Map Interface

This maps key value pairs.

We will look into some of the benefits of using Collections in Java.

Benefits of the Java Collections Framework

The Java Collections Framework provides the following benefits:

  • Reduces programming effort: By providing useful data structures and algorithms, the Collections Framework frees you to concentrate on the important parts of your program rather than on the low-level “plumbing” required to make it work. By facilitating interoperability among unrelated APIs, the Java Collections Framework frees you from writing adapter objects or conversion code to connect APIs.
  • Increases program speed and quality: This Collections Framework provides high-performance, high-quality implementations of useful data structures and algorithms. The various implementations of each interface are interchangeable, so programs can be easily tuned by switching collection implementations. Because you’re freed from the drudgery of writing your own data structures, you’ll have more time to devote to improving programs’ quality and performance.
  • Allows interoperability among unrelated APIs: The collection interfaces are the vernacular by which APIs pass collections back and forth. If my network administration API furnishes a collection of node names and if your GUI toolkit expects a collection of column headings, our APIs will interoperate seamlessly, even though they were written independently.
  • Reduces effort to design new APIs: This is the flip side of the previous advantage. Designers and implementers don’t have to reinvent the wheel each time they create an API that relies on collections; instead, they can use standard collection interfaces.
  • Allows software reuse: New data structures that conform to the standard collection interfaces are by nature reusable. The same goes for new algorithms that operate on objects that implement these interfaces.

References:

http://docs.oracle.com/javase/tutorial/collections/intro/index.html

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top