JAVA COLLECTION
FRAMEWORK
LIST INTERFACE
1
THE JAVA COLLECTIO
NS FRAMEWORK IS A
SET
OF CLASSES AND
INTERFACES THAT
IMPLEMENT
COMMONLY
REUSABLE
COLLECTION DATA
STRUCTURES
3
LIST INTERFACE
• The List interface in Java provides a way to store
the ordered collection.
• In this interface we can have control over where in
the list each element is inserted.
• The elements in the list can be accessed by their
integer index (position in the list), and search for
elements in the list.
• Lists allow duplicate elements
• The List.of and List.copyOf static methods that
provide a way to create unmodifiable lists
4
ABSTRACT LIST
CLASS
This class provides a skeletal
implementation of the List interface for
Random Access , Where as
AbstractSequenceList class is used when
sequential access is required
add (int index, E element)
add (E e)
remove (int index)
set (int index, E element)
5
6
ARRAYLIST
• Resizable-array implementation of the
List interface.
• Implements all optional list operations,
and permits all elements, including null.
• In addition to implementing the List
interface, this class provides methods to
manipulate the size of the array that is
used internally to store the list.
• It is not Synchonized
• CopyOnWriteArrayList, is a thread-safe
variant of ArrayList.
7
8
LINKEDLIST
• Linked List is a part of the Collection
framework present in java.util package.
• This class is an implementation of the
LinkedList data structure which is a linear
data structure where the elements are
not stored in contiguous locations.
• Every element is a separate object with a
data part and address part. The elements
are linked using pointers and addresses.
Each element is known as a node.
9
10
VECTOR
• Vector implements a dynamic array which
means it can grow or shrink as required.
• They are very similar to ArrayList, but
Vector is synchronized and has some legacy
methods that the collection framework does
not contain.
• It also maintains an insertion order like an
ArrayList. Still, it is rarely used in a non-
thread environment as it is synchronized,
and due to this, it gives a poor performance
in adding, searching, deleting, and updating
its elements.
11
STACK
•Java Collection framework provides a
Stack class that models and
implements a Stack data structure.
•The class is based on the basic
principle of last-in-first-out.
•In addition to the basic push and pop
operations, the class provides three
more functions of empty, search, and
peek.
12
13
THANK
YOU
14

Presentation.pptx on java oops concepts jcf

  • 1.
  • 2.
    THE JAVA COLLECTIO NSFRAMEWORK IS A SET OF CLASSES AND INTERFACES THAT IMPLEMENT COMMONLY REUSABLE COLLECTION DATA STRUCTURES
  • 3.
  • 4.
    LIST INTERFACE • TheList interface in Java provides a way to store the ordered collection. • In this interface we can have control over where in the list each element is inserted. • The elements in the list can be accessed by their integer index (position in the list), and search for elements in the list. • Lists allow duplicate elements • The List.of and List.copyOf static methods that provide a way to create unmodifiable lists 4
  • 5.
    ABSTRACT LIST CLASS This classprovides a skeletal implementation of the List interface for Random Access , Where as AbstractSequenceList class is used when sequential access is required add (int index, E element) add (E e) remove (int index) set (int index, E element) 5
  • 6.
  • 7.
    ARRAYLIST • Resizable-array implementationof the List interface. • Implements all optional list operations, and permits all elements, including null. • In addition to implementing the List interface, this class provides methods to manipulate the size of the array that is used internally to store the list. • It is not Synchonized • CopyOnWriteArrayList, is a thread-safe variant of ArrayList. 7
  • 8.
  • 9.
    LINKEDLIST • Linked Listis a part of the Collection framework present in java.util package. • This class is an implementation of the LinkedList data structure which is a linear data structure where the elements are not stored in contiguous locations. • Every element is a separate object with a data part and address part. The elements are linked using pointers and addresses. Each element is known as a node. 9
  • 10.
  • 11.
    VECTOR • Vector implementsa dynamic array which means it can grow or shrink as required. • They are very similar to ArrayList, but Vector is synchronized and has some legacy methods that the collection framework does not contain. • It also maintains an insertion order like an ArrayList. Still, it is rarely used in a non- thread environment as it is synchronized, and due to this, it gives a poor performance in adding, searching, deleting, and updating its elements. 11
  • 12.
    STACK •Java Collection frameworkprovides a Stack class that models and implements a Stack data structure. •The class is based on the basic principle of last-in-first-out. •In addition to the basic push and pop operations, the class provides three more functions of empty, search, and peek. 12
  • 13.
  • 14.