You are on page 1of 12

Collection Frame Work

Reference
Types of CFW
2 TYPES
New cfw(revised)
1d/single cfw
2d/double cfw
Legacy cfw(renamed version of data
structures)
1d cfw
Data is organized in the form of rows/columns
but not both
In order to work with 1d cfw we have to learn
1d cfw classes and interaces
1d cfw interfaces
Java.util.Collection
java.util.list
Java.util.set(extends from collections)
Java.util.sortedset(extends from set)
Methods in java.util.collection
Public int size()
Public boolean isEmpty()
Public boolean contains(object)
Public void clear()
Public boolean add(object)
Public iterator iterator()
Public object[] toArray()(it returns array of
objects of java.lang.object)
Methods in java.util.set
It doesnt contain special methods except
collection interaface methods.
Methods in java.util.Sortedset
Public object first()
Public object last()
Public sortedset headset(object obj)
(Xi < obj)
Public sortedset subset(object obj1,object obj2)
(Obj1 < =xi<obj2)
Public sortedset tailset(object obj)
(Xi>=obj)
Iterator(interaface present in java.util.*)

Methods
Public boolean hasNext()
Public boolean next()
Methods in java.util.list
it is a sub-interface of collection so, it can inherit
all the methods from present in collection
Separate methods:
Public void add(int,object)
Public object get(int)
Public object removeElementAt(int)
Public void remove(object)
Public void removeAll()
Public ListIterator listIterator()
ListIterator(sub-interface of iterator
interface)

Methods
Public boolean hasNext()
Public object next()
Public boolean hasPrevious()
Public object previous
Java.util.collections(predeined class)

Perorms algorithmic oriented operations


like(sorting the data,finding max.min
elements)
Methods
Public static void sort(List)
Public static object max(List)
Public static object min(List)
Type casting
The process of converting one type of value to
another type of value
-2 types are there
-fundamental variable type casting
Implicit typecasting
Explicit typecasting
-object typecasting

You might also like