DEV Community

pranavinu
pranavinu

Posted on • Edited on

Java Collection

Framework:
1)It provides an pre defined class and libraries(java files) to devoleper to bulit an web application
2)It reduce devolepment time
3)The per defined class can be reused

JCF(java collection frame work):
1)It is a group of interface and class
interface-list,set,queue
class-ArrayList,HashSet,LinkedList

collection:
1)It is an interface
2)It can't create an object directly
3)It has three types
*list
*set
*queue

ArrayList:
1)It is a pre-defined class,and it is an util package
2)It implements the list(interface)
3)It can create the object directly
4)The ArrayList object consist of an pre defined methods like
(add(),contains(),isEmpty(),remove(index),remove(Strings),
set(index,element),get(index))
contain() and isEmpty()- will return boolean values
5)It allows store the values as an object
6)It allows to store the different datatypes in a object
7)It allows to store the multiple null values
8)It allows to store the duplicate values

HashSet:
1)It is a pre-defined class,and it is an util package
2)It implements the set (interface)
3)It don't follow the insertion order
4)It don't allow the duplicate values in array

treeset:
1)it is a pre defined class
2)it implements from linkedlist
3)it gives a sorted output
4)it don't allow the null value
5)it don't allow the duplicate value

genreic:
1)it is to maintain the opreation in a similar datatype
2)it will show the exception at compiling
3)it is to avoid the casting exception
4)it is used for a pre-defined class like ArrayList,HashSet,TreeSet
Syntax:
HashSet list=new HashSet<>();

Top comments (0)