Java Containers

Description

As is common for modern data structure libraries, the Java

collection library separates interfaces and implementations. Let

us look at that separation with a familiar data structures, the List,

Set, Queue, Map and the parent interface Collection.

Reviews
Shared by: Vinothkumar
Stats
views:
92
rating:
not rated
reviews:
0
posted:
9/19/2009
language:
English
pages:
0
Java Containers By Mohit Kumar Dealing with Arrays • java.util.Arrays – Provides utility methods to deal with arrays for example comparing, sorting, and searching arrays. – Arrays.equals(a1,a2).A method overloaded to except all kinds of arrays, takes two arrays and compares them. The comparison is conceptual based on contents. – Arrays.deepEquals(a1,a2). A method to except two array of objects of arbitrary depth.Usually required for nested arrays. 13.10.2001 Designed By : Mohit Kumar Algorithmic sorting of ArraysComparable • • • Array comparisons(algorithmic operations or even simple sorting) was not supported in java 1.0 or 1.1. A problem with writing generic sorting code is that sorting must perform comparisons based on the actual type of the object. Of course, one approach is to write a different sorting method for every different type, but you should be able to recognize that this does not produce code that is easily reused for new types A primary goal of programming design is to “separate things that change from things that stay the same,” and here, the code that stays the same is the general sort algorithm, but the thing that changes from one use to the next is the way objects are compared. Designed By : Mohit Kumar • 13.10.2001 Algorithmic sorting of ArraysComparable • So instead of placing the comparison code into many different sort routines, the technique of the callback(quite like “equals()” method)is used. • With a callback, the part of the code that varies from case to case is separated, and the part of the code that’s always the same will call back to the code that changes • Java has two ways to provide comparison functionality. – The first is with the “natural” comparison method that is imparted to a class by implementing the java.lang.Comparable interface. This is a very simple interface with a single method, compareTo( ). – This method takes another Object as an argument and produces a negative value if the current object is less than the argument, zero if the argument is equal, and a positive value if the current object is greater than the argument 13.10.2001 Designed By : Mohit Kumar Algorithmic sorting of ArraysComparable public class CompType implements Comparable { int i; public CompType(int n1) { i = n1; } public String toString() { return "[i = " + i + "]"; } public int compareTo(Object rv) { int rvi = ((CompType)rv).i; return (i < rvi ? -1 : (i == rvi ? 0 : 1)); } public static void main(String[] args) { Arrays.sort(a); } 13.10.2001 Designed By : Mohit Kumar Algorithmic sorting of ArraysComparable • If Comparable hadn’t been implemented, then you’d get a ClassCastException at run time when you tried to call sort( ). This is because sort( ) casts its argument to Comparable. Now suppose someone hands you a class that doesn’t implement Comparable, or hands you this class that does implement Comparable, but you decide you don’t like the way it works and would rather have a different comparison method for the type. • 13.10.2001 Designed By : Mohit Kumar Algorithmic sorting of ArraysComparator • • The solution is in contrast to hard-wiring the comparison code into each different object. Instead, the strategy design pattern is used. With a strategy, the part of the code that varies is encapsulated inside its own class (the strategy object). You hand a strategy object to the code that’s always the same, which uses the strategy to fulfill its algorithm. That way, you can make different objects to express different ways of comparison and feed them to the same sorting code. Here, you create a strategy by defining a separate class that implements an interface called Comparator. • • • 13.10.2001 Designed By : Mohit Kumar Algorithmic sorting of ArraysComparator • • This has two methods, compare( ) and equals( ). However, you don’t have to implement equals( ) except for special performance needs, because anytime you create a class, it is implicitly inherited from Object, which has an equals( ). So you can just use the default Object equals( ) and satisfy the contract imposed by the interface. • 13.10.2001 Designed By : Mohit Kumar Algorithmic sorting of ArraysComparator public class Reverse { public static void main(String[] args) { CompType[] a ={new CompType(2,3),new CompType(4,3),new CompType(3,3),new CompType(1,3)}; System.out.println( "before sorting, a = " + Arrays.asList(a)); //”reverseOrder()” method returns a comparator that reverses the // comparable(natural) sorting order…… Arrays.sort(a, Collections.reverseOrder()); } } 13.10.2001 Designed By : Mohit Kumar Algorithmic sorting of ArraysComparator class CompTypeComparator implements Comparator { public int compare(Object o1, Object o2) { int j1 = ((CompType)o1).j; int j2 = ((CompType)o2).j; return (j1 < j2 ? -1 : (j1 == j2 ? 0 : 1)); } } // your own comparator…. public class ComparatorTest { public static void main(String[] args) { Arrays.sort(a, new CompTypeComparator()); } } 13.10.2001 Designed By : Mohit Kumar Algorithmic sorting of Arraysbinary search • Arrays.binarySearch(sortedarray,elementtobesearhed). – produces a value greater than or equal to zero if the search item is found. Otherwise, it produces a negative value representing the place that the element should be inserted if you are maintaining the sorted array by hand. The value produced is “-(insertion point) - 1 “ – The insertion point is the index of the first element greater than the key, or a.size( ), if all elements in the array are less than the specified key – If the array contains duplicate elements, there is no guarantee which one will be found. The algorithm is thus not really designed to support duplicate elements, but rather to tolerate them – Primitive arrays don’t allow Comparator or Comparable interfaces. 13.10.2001 Designed By : Mohit Kumar Algorithmic sorting of Arraysbinary search • Arrays.binarySearch(sortedarray,elementtobesearched,compara torobject) – If you have sorted an object array using a Comparator (primitive arrays do not allow sorting with a Comparator), you must include that same Comparator when you perform a binarySearch( ) (using the overloaded version of the method that’s provided). – System.arrayCopy(Object src, int srcPos, Object dest, int destPos, int length). Overloaded method to support all types performs much faster than looped copying. – Never to try binary search on an unsorted array of any kinds. 13.10.2001 Designed By : Mohit Kumar Introduction to Containers • The Java 2 container library takes the issue of “holding your objects” and divides it into two distinct concepts: – Collection: a group of individual elements, often with some rule applied to them. – A List must hold the elements in a particular sequence, and a Set cannot have any duplicate elements. – (A bag, which is not implemented in the Java container library—since Lists provide you with enough of that functionality—has no such rules.) 13.10.2001 Designed By : Mohit Kumar Introduction to Containers – Map: a group of key-value object pairs. – Thus, a Map can return a Set of its keys, a Collection of its values, or a Set of its pairs. – Maps, like arrays, can easily be expanded to multiple dimensions without adding new concepts; you simply make a Map whose values are Maps (and the values of those Maps can be Maps, etc.). 13.10.2001 Designed By : Mohit Kumar Introduction to Containers • • With the advent of JDK 1.2, the designers felt that the time had come to roll out a fullfledged set of data structures. They faced a number of conflicting design decisions. They wanted the library to be small and easy to learn. They did not want the complexity of the "Standard Template Library" (or STL) of C++, but they wanted the benefit of "generic algorithms" that STL pioneered. They wanted the legacy classes to fit into the new framework. As all designers of collection libraries do, they had to make some hard choices, and they came up with a number of idiosyncratic design decisions along the way. In this section, we will explore the basic design of the Java collections framework, show you how to put it to work, and explain the reasoning behind some of the more controversial features. Designed By : Mohit Kumar • 13.10.2001 Introduction to Containers • As is common for modern data structure libraries, the Java collection library separates interfaces and implementations. Let us look at that separation with a familiar data structures, the List, Set, Queue, Map and the parent interface Collection. 13.10.2001 Designed By : Mohit Kumar Collection • java.util.Collection – Iterator iterator() returns an iterator that can be used to visit the elements in the collection. – int size() return; the number of elements currently stored in the collection. – boolean isEmpty() returns true if this collection contains no elements. – boolean contains(Object ob) returns true if this collection contains an object equal to ob. – boolean containsAll(Collection other) returns true if this collection contains all elements in the other collection. – boolean add(Object element) adds an element to the collection. Returns true if the collection changed as a result of this call. 13.10.2001 Designed By : Mohit Kumar Collection – boolean addAll(Collection other) adds all elements from the other collection to this collection. Returns true if the collection changed as a result of this call. – boolean remove(Object obi) removes an object equal to obj from this collection. Returns true if a matching object was removed. – boolean removeAll(Collection other) removes from this collection all elements from the other collection. Returns true if the collection changed as a result of this call. – void clear() removes all elements from this collection. – boolean retainAll(Collection other) removes all elements from this collection that do not equal one of the elements in the other collection. Returns true if the collection changed as a result of this call. – Obiect[] toArray() returns By : Mohit Kumarthe objects in the 13.10.2001 Designed an array of collection. Iterator • java.util.Iterator – boolean hasNext() returns true if there is another element to visit. – Next() returns the next object to visit. Throws a NoSuchElementException if the end of the collection has been reached. – void remove() removes the last visited object. This method must immediately follow an element visit. If the collection has been modified since the last element visit, then the method throws an IllegalStateException. 13.10.2001 Designed By : Mohit Kumar Almost All Implementation classes • Concrete Collections in the Java Library – ArrayList An indexed sequence that grows and shrinks dynamically – LinkedList An ordered sequence that allows efficient insertions and removal at any location – HashSet An unordered collection that rejects duplicates – TreeSet A sorted set – EnumSet A set of enumerated type values – LinkedHashSet A set that remembers the order in which elements were inserted – PriorityQueue A collection that allows efficient removal of the smallest element Designed By : Mohit Kumar 13.10.2001 Almost All Implementation classes – – – HashMap A data structure that stores key/value associations TreeMap A map in which the keys are sorted EnumMap A map in which the keys belong to an enumerated type – LinkedHashMap A map that remembers the order in which entries were added – WeakHashMap A map with values that can be reclaimed by the garbage collector if they are not used elsewhere – IdentityHashMap A map with keys that are compared by ==, not equals() 13.10.2001 Designed By : Mohit Kumar List and its Implementations • • • List is a Data Structure where natural ordering(e.g. insertion order) is important. It can take duplicates. There are two very important implementations the LinkedList and the ArrayList. The two implementations optimize on different kind of operations. 13.10.2001 Designed By : Mohit Kumar LinkedList • Linked Lists – However, arrays and (their dynamic cousin)ArrayLists suffer from a major drawback. – Removing an element from the middle of an array is expensive since all array elements beyond the removed one must be moved toward the beginning of the array. – The same is true for inserting elements in the middle. – Another well-known data structure, the linkedlist, solves this problem. – Whereas an array stores object references in consecutive memory locations, a linked list stores each object in a separate link. – Each link also stores a reference to the next link in the sequence. In the Java programming language, all linked lists are actually doublyDesigned Bythat is, each link also stores a linked; : Mohit Kumar 13.10.2001 reference to its predecessor. LinkedList 13.10.2001 Designed By : Mohit Kumar LinkedList • Adding and removing elements List staff = new LinkedList(); staff.add ( "Amy") staff.add ("Bab"); staff.add("Carl"); Iterator iter = staff.iterator(); String first = iter.next(); // visit first element String second = iter.next(); // visit second element iter.remove(); //remove last visited element 13.10.2001 Designed By : Mohit Kumar LinkedList 13.10.2001 Designed By : Mohit Kumar LinkedList • • • • • There is, however, an important difference between linked lists and generic collections. A linked list is an ordered collection in which the position of the objects matters. The LinkedList add method adds the object to the end of the list. But you often want to add objects somewhere in the middle of a list. This position-dependent add method is the responsibility of an iterator, since iterators describe positions in collections. Using iterators to add elements makes sense only for collections that have a natural ordering. For example, the set data type does not impose any ordering on its elements. Therefore, there is no add method in the Iterator interface. Instead, the collections library supplies a subinterface ListIterator that contains an add method.(the reason for a separate interface) Designed By : Mohit Kumar 13.10.2001 LinkedList • • Also listIterators can iterate in either direction. The listIterator method of the LinkedList class returns an iterator object that implements the ListIterater interface. ListIterator iter = staff.listIterator(); • The add method adds the new element before the iterator position. For example, the following code skips past the first element in the linked list and adds "Juliet" before the second element. List staff = new LinkedList(); staff.add("Amy"); staff.add("Bob"); staff.add("Carl"); ListIterator iter = staff.listlterator(); iter.next(); // skip past first element 13.10.2001 Designed By : Mohit Kumar iter.add("Juliet");  LinkedList 13.10.2001 Designed By : Mohit Kumar LinkedList • You have to be careful with the "cursor" analogy. The remove operation does not quite :work like the BACKSPACE key. Immediately after a call to next, the remove method indeed removes the element to the left of the iterator, just like the BACKSPACE key would. However, if you just called previous, the element to the right is removed. And you can't call remove twice in a row.(reason later:1) Unlike the add method, which depends only on the iterator position, the remove method depends on the iterator state. • • 13.10.2001 Designed By : Mohit Kumar LinkedList • Concurrent Modification – As you might imagine, if an iterator traverses a collection while another iterator is modifying it, confusing situations can occur. For example, suppose an iterator points before an element that another iterator has just removed. – The iterator is now invalid and should no longer be used. The linked list iterators have been designed to detect such modifications. – If an iterator finds that its collection has been modified by another iterator or by a method of the collection itself, then it throws a ConcurrentModificationException.(reasonlater:1a) 13.10.2001 Designed By : Mohit Kumar LinkedList List list = ……………. Listlterator iterl = list.listIterator(); ListIterator iter2 = list.listIterator(); iterl.next(); iterl.remove(); iter2.next(); // throws ConcurrentModificationException // checks only structural modifications of the Data Structure. 13.10.2001 Designed By : Mohit Kumar LinkedList • To avoid concurrent modification exceptions, follow this simple rule: – You can attach as many iterators to a collection as you like, provided that all of them are only readers. – Alternatively, you can attach a single iterator that can both read and write. • Concurrent modification detection is achieved in a simple way. The collection keeps track of the number of mutating operations (such as adding and removing elements). – Each iterator keeps a separate count of the number of mutating operations that it was responsible for. At the beginning of each iterator method, the iterator simply checks whether its own mutation count equals that of the collection. – If not, it throws a ConcurrentModificationException. This is an excellent check and a great: improvement over the 13.10.2001 Designed By Mohit Kumar fundamentally unsafe iterators in the C++,STL framework. ArrayList • • • • • In the preceding section, you saw the List interface and the LinkedList class that implements it. The List interface describes an ordered collection in which the position of elements matters. There are two protocols for visiting the elements: through an iterator and by random access with methods get and set. The latter is not appropriate for linked lists, but of course get and set make a lot of sense for arrays. The collections library supplies the familiar ArrayList class that also implements the List interface. An Arraylist encapsulates a dynamically reallocated array of objects. 13.10.2001 Designed By : Mohit Kumar Vector • • • If you are a veteran Java programmer, you may have used the Vector class whenever you needed a dynamic array. Why use an ArrayList instead of a Vector? For one simple reason: All methods of the Vector class are synchronized. It is safe to access a Vector object from two threads. But if you access a vector from only a single thread-by far the more common case your code wastes quite a bit of time with synchronization. In contrast, the ArrayList methods are not synchronized. you use an Arraylist instead of a Vector whenever you don't need synchronization. • 13.10.2001 Designed By : Mohit Kumar List Comparisons Type array ArrayList LinkedList Vector 13.10.2001 Get 172 281 5828 422 Iteration 516 1375 1047 1890 Designed By : Mohit Kumar Insert na 328 109 360 Remove na 30484 16 30781 Set • • A data Structure which does not take duplicates. Linked lists and arrays let you specify the order in which you want to arrange the elements. However, if you are looking for a Particular element and you don’t remember it position, then you need to visit all elements until you find a match. That can be time consuming if the collection contains many elements. If you don't Care about the ordering of the elements, then there are data structures that let you find elements much faster the drawback is that those data structures give you no control over the order in which the elements appear. The organization is internal to the data structure. The Structures are HashSet, TreeSet. Designed By : Mohit Kumar • • 13.10.2001 HashSet • A well-known data structure for finding objects quickly is the hash table. A hash table computes an integer, called the hash code, for each object. A hash code is an integer that is somehow derived from the instance fields of an object, preferably such that objects with different data yield different codes. If you define your own classes, you are responsible for implementing your own hashCode method. A hash table is an array of linked lists. Each list is called a bucket. • • • 13.10.2001 Designed By : Mohit Kumar HashSet • To find the place of an object in the table, compute its hash code and reduce it modulo the total number of buckets. – The resulting number is the index of the bucket that holds the element. For example, if an object has hash code 76268 and there are 128 buckets, then the object is placed in bucket 108 (because the remainder 76268 % 128 is 108). – Perhaps you are lucky and there is no other element in that bucket. Then, you simply insert the element into that bucket. – Of course, it is inevitable that you sometimes hit a bucket that is already filled. 13.10.2001 Designed By : Mohit Kumar HashSet – This is called a hash collision (hashtable is an array of linked lists not a linked list of linked lists for obvious reasons). – Then, you compare the new object with all objects in that bucket to see if it is already present. – Provided that the hash codes are reasonably randomly distributed and the number of buckets is large enough, only a few comparisons should be necessary. 13.10.2001 Designed By : Mohit Kumar HashSet 13.10.2001 Designed By : Mohit Kumar HashSet • Of course, you do not always know how many elements you need to store, or your initial guess may be too low and the table might get filled requiring more comparisons because of collisions. If the hash table gets too full, it needs to be rehashed. To rehash the table, a table with more buckets is created, all elements are inserted into the new table, and the original table is discarded. The load factor determines when a hash table is rehashed. For example, if the load factor is 0.75 (which is the default) and the table is more than 75% full, then it is automatically rehashed, with twice as many buckets. For most applications, it is reasonable to leave the load factor at 0.75. Designed By : Mohit Kumar • • 13.10.2001 HashSet • Hash tables can be used to implement several important data structures. The simplest among them is the SET type. A set is a collection of elements without duplicates. The add method of a set first tries to find the object to be added, and adds it only if it is not yet present. • The Java collections library supplies a HashSet class that implements a set based on a hash table. You add elements with the add method. The contains method is redefined to make a fast lookup to find if an element is already present in the set. It checks only the elements in one bucket and not all elements in the collection. • The hash set iterator visits all buckets in turn. Because the hashing scatters the elements around in the table, they are visited in seemingly random order. You would only use a HashSet if you don't care about the ordering of the elements in 13.10.2001 Designed By : Mohit Kumar the collection. HashSet • Generally superior to any other set implementation.Your default choice of Set if you don’t have any other consideration. 13.10.2001 Designed By : Mohit Kumar TreeSet • • • • The TreeSet is similar to a hash set, with one added functionality. A tree set is an ordered collection. When you iterate the elements are presented in the sorted order. Adding elements to a tree is much slower than the hash set but faster than an array or linked list. The current implementation uses a red-black tree, however there is a talk about shifting to an AVL tree. Ordering – The TreeSet assumes that the elements have implemented the Comparable interface(only one implementation of ordering depending on the “compareTo()”). – The other way out is to pass a comparator implementation to tree set. This way there can be several comparators based on requirement. Designed By : Mohit Kumar 13.10.2001 TreeSet • Red Black Tree – These are binary trees with the following properties. Every node has a value. • The value of any node is greater than the value of its left child and less than the value of its right child. • Every node is colored either red or black. • Every red node that is not a leaf has only black children. • Every path from the root to a leaf contains the same number of black nodes. • The root node is black. • The memory representation is done using Linked List Designed By : Mohit Kumar 13.10.2001 TreeSet • Red Black Tree 13.10.2001 Designed By : Mohit Kumar Set Comparisons Test size   TreeSet     HashSet     LinkedHashSet 10 100 1000 10 100 1000 10 100 1000 Add 25.0 17.2 26.0 18.7 17.2 8.8 20.3 18.6 Contains 23.4 27.5 30.2 17.2 19.1 16.6 18.7 19.5 16.3 Iteration 39.1 45.9 9.0 64.1 65.2 12.8 64.1 49.2 10.0 13.10.2001   Designed By : Mohit Kumar 10.0 Queues • • • A collection designed for holding elements prior to processing. Besides basic Collection operations, queues provide additional insertion, extraction, and inspection operations. Queues typically, but do not necessarily, order elements in a FIFO (first-in-first-out) manner. Among the exceptions are priority queues, which order elements according to a supplied comparator, or the elements' natural ordering(Comparable), and LIFO queues (or stacks) which order the elements LIFO (last-in-first-out). Whatever the ordering used, the head of the queue is that element which would be removed by a call to remove() or poll(). Every Queue implementation must specify its ordering properties. Designed By : Mohit Kumar • • 13.10.2001 Priority Queues • • Priority queue retrieves elements in sorted order after they were inserted in arbitrary order. That is, whenever you call the remove method, you get the smallest element currently in the priority queue. However, the priority queue does not sort all its elements. If you iterate over the elements, they are not necessarily sorted. The priority queue makes use of an elegant and efficient data structure, called a heap. A heap is a self-organizing binary tree in which the add and remove operations cause the smallest element to gravitate to the root, without wasting time on sorting all elements. Just like a TreeSet, a priority queue can either hold elements of a class that implements the Comparable interface or a Comparator object you supply in the constructor. Designed By : Mohit Kumar • • • 13.10.2001 Priority Queues • A typical use for a priority queue is job scheduling. Each job has a priority. Jobs are added in random order. Whenever a new job can be started, the highest-priority job is removed 13.10.2001 Designed By : Mohit Kumar Heap Order • Heap Order Property – The property that allows operations to be performed quickly is the heap order property. Since we want to be able to find the minimum(or maximum, but that needs to be decided beforehand) quickly, it makes sense that the smallest element should be at the root. If we consider that any subtree should also be a heap, then any node should be smaller than all of its descendants. – Applying this logic, we arrive at the heap order property. In a heap, for every node X, the key in the parent of X is smaller than (or equal to) the key in X, with the exception of the root. 13.10.2001 Designed By : Mohit Kumar A heap insertion 13.10.2001 Designed By : Mohit Kumar A heap removal 13.10.2001 Designed By : Mohit Kumar Heap,its friend(array) and (2i,2i+1) 13.10.2001 Designed By : Mohit Kumar Map • • An object that maps keys to values. A map cannot contain duplicate keys; each key can map to at most one value. The Map interface provides three collection views, which allow a map's contents to be viewed as a set of keys, collection of values, or set of key-value mappings. The order of a map is defined as the order in which the iterators on the map's collection views return their elements. Some map implementations, like the TreeMap class, make specific guarantees as to their order; others, like the HashMap class, do not. 13.10.2001 Designed By : Mohit Kumar Map Comparison Test size Put Get Iteration   TreeMap     HashMap     LinkedHashMap     Hashtable 10 100 1000 10 100 1000 10 100 1000 10 100 1000 26.6 34.1 27.8 21.9 21.9 11.5 23.4 24.2 12.3 18.8 19.4 13.1 20.3 27.2 29.3 18.8 18.6 18.8 18.8 19.5 19.0 18.7 20.9 19.9 43.7 45.8 8.8 60.9 63.3 12.3 59.4 47.8 9.2 65.7 55.3 10.8 13.10.2001   Designed By : Mohit Kumar Map Comparison • • As you might expect, Hashtable performance is roughly equivalent to HashMap. (You can also see that HashMap is generally a bit faster; HashMap is intended to replace Hashtable.) The TreeMap is generally slower than the HashMap, so why would you use it? As a way to create an ordered list. The behavior of a tree is such that it’s always in order and doesn’t have to be specially sorted. Once you fill a TreeMap, you can call keySet( ) to get a Set view of the keys, then toArray( ) to produce an array of those keys. You can then use the static method Arrays.binarySearch( ) to rapidly find objects in your sorted array. Of course, you would probably only do this if, for some reason, the behavior of a HashMap was unacceptable, since HashMap is designed to rapidly find things. Designed By : Mohit Kumar • • 13.10.2001 Map Comparison • In the end, when you’re using a Map, your first choice should be HashMap, and only if you need a constantly sorted Map will you need TreeMap. 13.10.2001 Designed By : Mohit Kumar java.util.Collections • Utility class like the Arrays with similar capabilities. – – – – – – static void sort(List elements) static void sort(List elements,Comparator comp) static Comparator reverseOrder() static Comparator reverseOrder(Comparator comp) static int binarySearch(Collection c,Object element ) static int binarySearch(Collection c,Object element , Comparator comp) 13.10.2001 Designed By : Mohit Kumar java.util.Collections • And so many other methods to return non-modifiable or synchronized collections.. – static Collection unmodifiableCollection(Coliection c) – static List unmodifiablelist(list c) – static Set unmodifiable5et(Set c) – static SortedSet unmodifiableSortedSet(Sorted5et t) – static Map unmodifiableMap(Map c) – static SortedMap unmodifiableSortedMap(SortedMap c) “construct a view of the collection whose mutator methods throw an - UnsupportedOperationException. 13.10.2001 Designed By : Mohit Kumar java.util.Collections – – – – – – Static Collection synchronizedCollection(Collection c) static List synchronizedList(List c) static Set synchronizedSet(Set c) static SortedSet synchronizedSortedSet(SortedSet c) static Map synchronizedMap(Map c) static SortedMap synchronizedSortedMap(SortedMap c) Constructs a view of the collections whose methods, are synchronized. 13.10.2001 Designed By : Mohit Kumar Interfaces 13.10.2001 Designed By : Mohit Kumar The Total picture, almost!!!! 13.10.2001 Designed By : Mohit Kumar The Total picture, almost!!!! 13.10.2001 Designed By : Mohit Kumar

Related docs
webDynpro for java
Views: 1015  |  Downloads: 48
How to use Solaris10 containers
Views: 1  |  Downloads: 1
Ch 9. Templates and Containers
Views: 14  |  Downloads: 0
JAVA
Views: 20  |  Downloads: 9
Introduction to OpenSocial Apps Containers
Views: 332  |  Downloads: 15
Collections in Java
Views: 166  |  Downloads: 20
Computer Notes
Views: 18  |  Downloads: 1
premium docs
Other docs by Vinothkumar
Sears Black Friday 2009 Deals
Views: 109  |  Downloads: 5
How to be noticed
Views: 59  |  Downloads: 0
How to be a good manager
Views: 96  |  Downloads: 2
How to Be an Effective Project Manager
Views: 33  |  Downloads: 0
How to Resolve a Conflict at Work
Views: 54  |  Downloads: 2
How to Be a Leader
Views: 25  |  Downloads: 2
How to Write a Resignation Letter
Views: 142  |  Downloads: 0
How to Respond to a Job Performance Review
Views: 113  |  Downloads: 0
How to Fire an Employee
Views: 138  |  Downloads: 3
How to Ask for a Pay Raise
Views: 39  |  Downloads: 2
How to Make a Resume
Views: 33  |  Downloads: 2
How to Get a Promotion
Views: 465  |  Downloads: 1
How to Train Someone to Do Your Job
Views: 31  |  Downloads: 0
How to Switch Careers
Views: 19  |  Downloads: 0