Java Abstract Data Type in Data Structure – ADT

1. Java ADT – Objective

Previously we saw, Data Structure in Java, and today we will talk about our fourth part Java Abstract Data Type in Data Structure notes, with a list of Abstract Data Types: List ADT, Stack ADT, and Queue ADT in detail, also we will discuss abstract data types problems.

So, let us start Java Abstract Data Types.

Java Abstract Data Type in Data Structure - ADT

Abstract Data Type in Data Structure – ADT

2. What is the Java Abstract Data Type (ADT)?

Java abstract data type(ADT) in a data structure is a type of data type whose behaviour is defined by a set of operations and values.

In Java abstract data type, we can only know what operations are to be performed and not how to perform them i.e. it does not tell how algorithms are to be implemented or how the data will be organized in the memory. This type is thus called abstract as it does not give the view of implementation.

Do you know about Linear Data Structures in Java 

3. List of Abstract Data Types (ADTs)

a. List ADT

A list abstract data type is the type of list which contains similar elements in sequential order and following are the operations which can be performed on list.

"List

i. get() – Return an element from the list.

ii. insert() – Insert an element at any position.

iii. remove() – Remove the first occurrence of any element from a non-empty list.

iv. removeAt() – Remove the element at a predefined area from a non-empty list.

v. Replace() – Replace an element by another element.

vi. size() – Returns number of elements of the list.

vii. isEmpty() – Return true if the list is empty, else return false.

viii. isFull() – Return true only if the list is full, else return false.

Read about Hierarchical Data Structure in Java

b. Stack ADT

A stack contains similar elements which are in an ordered sequence. All the operations in stack takes place at the top of the stack. Following are the operations which are performed on the stack-

Stack ADT- Stack Abstract Data Type

Stack ADT- Stack Abstract Data Type

i. push() – Insert an element at the top of stack.

ii. pop() – Remove an element from the top of the stack, If it is not empty.

iii. peep() – Returns the top element of stack without removing it.

iv. size() – Returns the size of the stack.

v. isEmpty() – Return true if the stack is empty, else it returns false.

vi. isFull() – Return true if the stack is full, else it returns false.

Let’s revise Interface in Java Method Overriding in Java in detail

c. Queue ADT

The elements of the queue are of the same type which are arranged sequentially. The operations can be performed at both ends, insertion is done at rear end deletion is done at the front end. Operations performed on the queue are as follows-

Queue ADT - Queue Abstract Data Type

Queue ADT – Queue Abstract Data Type

i. enqueue() – Inserting an element at the end of queue.

ii. dequeue() – Removing an element of the queue.

iii. peek() – Returns the element of the queue without removing it.

iv. size() – Returns the number of elements in the queue.

v. isEmpty() – Return true if the queue is empty, else it returns false.

vi. isFull() – Return true if the queue is full, else it returns false.

So, this was all about Java Abstract Data Types. Hope you like our explanation.

Java Quiz

4. Conclusion

Hence, In this Java ADT tutorial, we are learned Java Abstract Data Type (ADT) and the types of Abstract Data Type in Java: List ADT, Stack ADT, and Queue ADT in detail with the end of this tutorial we have covered all types of data structures. In the upcoming tutorials, we will study in detail the different types that we have studied. Furthermore, if you have any query, feel free to ask in a comment section.

See Also – Identifiers in Java

For reference

Leave a Reply

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

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.