Posts

Showing posts from November 19, 2010

List Interface

List Interface : "List interface is used for storing element as a sequence. It means List maintain the sequence according to inserted order. List interface extends the Collection interface. List maintains the index of all elements. So you can insert and retrieve elements by their index. Keep in mind that list may contain duplicate elements. ..." Read Full About click on List Interface

List Interface

List Interface –             List interface is used for storing element as a sequence.  It means List maintain the sequence according to inserted order. List interface extends the Collection interface. List maintains the index of all elements. So you can insert and retrieve elements by their index.             Keep in mind that list may contain duplicate elements.             List interface has its own methods which described below – void add(int index, Object obj) –             This method is used for insert element at given position into the List. Element which is already exist on the given index automatically shifted up. boolean addAll(int index, Collection c) –             This method adds all the object of Collection c at given index and return true, otherwise return false in case of failure.   Object get(int index) –             This method return the element of given index. int indexOf(Object obj) –             This method return the inedx of given element. int lastIndexOf(Objec

Set Interface

Java collections framework: Set Interface : "Set is very important when you want to collect unique elements. Set is follows the mathematical fundamental of Set. Set Interface can contains one null value also. But some implementation classes are not allowed the null value...." Read More Articles    click on this link.

Set Interface

Set Interface -       Set is very important when you want to collect unique elements. Set is follows the mathematical  fundamental of Set. Set Interface can contains one null value also. But some implementation classes are not allowed the null value.     Set is not permitted two elements if both are equals. When any element is being added in set internally it check the element is already exist or not through equals and hashcode method. So Set override  equals and hashcode both method.     Set has no extra method. It extends Collection interface. So all method of collection interface is in the Set. But set interface restrict the duplicate elements.    There are some classes which implements the Set Interface. 1.AbstractSet 2.ConcurrentSkipListSet 3.CopyOnWriteArraySet 4.EnumSet 5.HashSet 6.JobStateReasons 7.LinkedHashSet 8.TreeSet                        If you want to add any immutable element in the set interface. So behavior of set can be change if the value of the element is changed

Recent Post

Recent Posts Widget