Coder Social home page Coder Social logo

java-collections-framework's Introduction

Java Collections Framework

Learning Goals

  • Explain what is meant by data structures.
  • Give an overview of the collections framework in Java.

What are Data Structures?

At its core, programming is all about representing and manipulating data. Data structures define how we represent data and algorithms define how we manipulate them.

Data structures describe how data should be stored, arranged, and accessed. We have to pick the right data structure depending on the problem at hand. For example, if we need to assign priority to our data we could use a priority queue.

Java provides us with several implementations of the most common data structures. We’ll learn about the most common ones in the following lessons.

What are Collections?

Collections are representations of different data structures and abstract data types. All modern collections we’ll be using are generic, i.e., we can specify any reference type as a generic parameter and store it in the collection. But note that collections do not allow primitive values, so instead of using primitives like int, double, char, we have to use Integer, Double, Character.

What is the Collections Framework?

Java organizes collections using a clear hierarchy. The framework contains interfaces, abstract classes, concrete classes (the data structure implementation) which incorporate unique algorithms. There are two main interfaces: Collection and Map.

The Collection interface is used by data structures or collections that contain a list of elements of the same type.

Collection Framework Diagram

The Map interface is used by collections that store a pair of values.

Map Interface Diagram

These collections have a clear hierarchy, well-defined APIs, and high-performance which drastically reduces programming overhead, increases program speed, makes it easier to interoperate across systems, and makes it easy to learn new APIs based on this structure.

In the next few lessons, we will discuss both the Collection and Map interfaces along with most of the concrete classes shown in the diagrams.

Conclusion

We'll take a deeper look at both of these interfaces in the coming sections. You'll be using these interfaces quite frequently when working on applications.

java-collections-framework's People

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.