April 05
Prde. Ismael H. F. Santos -  ismael@tecgraf.puc-rio.br                                                          2
Coleções Sincronizadas
npublic static Collection synchronizedCollection(Collection c);
npublic static Set synchronizedSet(Set s);
npublic static List synchronizedList(List list);
npublic static Map synchronizedMap(Map m);
n
npublic static SortedSet synchronizedSortedSet(SortedSet s);
npublic static SortedMap synchronizedSortedMap(SortedMap m);
n
nExemplos
n
nList l = Collections.synchronizedList (new ArrayList());// = Vector !
n
nCollection c = Collections.synchronizedCollection(myCollection);
nsynchronized(c) {
n  Iterator i = c.iterator(); // Must be in synchronized block!
n  while( i.hasNext() )
n    foo(i.next());
n}