Collection and Database Programing PART1
Collection and Database Programing PART1
Programming
Introduction
Data Structure-It is using data in memory in a Efficient manner.
Time and Space Complexity is seen here.
It has various algorithms for searching, sorting, insertion, manipulation, and deletion.
• Syntax-
Array vs ArrayList
• Arrays: Used to Save Primitive and Non Primitive Data Type.
Saves Homogeneous contents.
Cannot increase or decrease size of Array during Runtime.
Need to Develop algorithm for Sorting, Searching etc.
ListIterator:
2. ListIterator cursor gets by listiterator();
ListIterator lr= l.listiterator();
2. It can be used for Listt Implemented Classes
. ArrayList,LinkedList,Vector,Stack.
3. Iterator methods are hashnext(),next(), hashprevious(),previous() remove(),set().
4. By using Iterator we can retrieve forward and backward direction.
Using Iterator we can read, remove,replace and add elements.
5. It is used opnly for List Implement Classes only.
Enumeration in Java
• Enemuration is cursor which is used to return collection of object one by one.
• Used for Legacy Classes- Vector, Stack.
• Enumeration cursor gets through elements().
Enumeration e=v.elements();
Methods in Enumeration:
hasMoveElements(), nextElement().
• Enumeration cursor can be used to return elements in Forward Direction.
• It cannot remove elements.
• Enumeration can be used only to read Operation