Collection Framework Research Paper

879 Words4 Pages
Collection Framework

Collection basically represents a group i.e., set of object units. JAVA provides Collection framework to manipulate group of objects with operations like sorting, seraching , insertion etc.

Util Package Interfaces, List, Set, Map

The util package constitutes the collection framework, date and time and other utility classes.
• List (-- removed HTML --) stores the data in sequence .
• Set (-- removed HTML --) is the set of unique elements
• Map (-- removed HTML --) is the set which works on the key and value concept. In this key is the unique value

List Interface & its classes

List is under java.util.List interface which is the collection of ordered elements which can be duplicate. The insertion is on the basis
…show more content…
Only static data members and methods of outer class is accessible though Static Inner Class

class TestStatic1{ static int variable=30; static class InnerStatic{ void msg(){System.out.println("Variable is "+variable);} } public static void main(String args[]){ TestStatic1.InnerStatic obj=new TestStatic1.InnerStatic(); obj.msg(); }

Output: Variable is 30

Local Inner Class

In JAVA we can also create a class inside a method referred as Local Inner Class. In case of invoking methods of inner class, it is important to instantiate it inside the method

public class InnerClass1{ private int a=30;//instance variable void display(){ class LocalClass{ void msg(){System.out.println(a);} } LocalClass l=new LocalClass(); l.msg(); } public static void main(String args[]){ InnerClass1obj=new InnerClass1(); obj.display(); }

Output: 30

Anonymous Inner Class

Anonymous class does not have no name basically used to override method of any class or any interface. abstract class Maan{ abstract void eat();
class AnonymousClass{ public static void main(String args[]){
Get Access