Java Abstract Data Type in Data Structure – ADT

Java abstract data type(ADT) in a data structure is a type of data type whose behavior 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.

To get in-Depth knowledge on Java you can enroll for a live demo on Java Online Training

List of Abstract Data Types (ADTs)

a. List ADT

A list abstract data type is the type of list that contains similar elements in sequential order and the following are the operations that can be performed on 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 a 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.

Take your career to new heights of success with Java Training

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-

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.

c. Queue ADT

The elements of the queue are of the same type which is 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-

i. enqueue() – Inserting an element at the end of the 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. I hope you like our explanation.