190 likes | 307 Views
Lecture 14. Generic bean renderer & some more information on collections. public static Collection synchronizedCollection(Collection c); public static Set synchronizedSet(Set s); public static List synchronizedList(List list); public static Map synchronizedMap(Map m);
E N D
Lecture 14 Generic bean renderer & some more information on collections
public static Collection synchronizedCollection(Collection c); public static Set synchronizedSet(Set s); public static List synchronizedList(List list); public static Map synchronizedMap(Map m); public static SortedSet synchronizedSortedSet(SortedSet s); public static SortedMap synchronizedSortedMap(SortedMap m);
Collection c = Collections.synchronizedCollection(myCollection); synchronized(c) { Iterator i = c.iterator(); // Must be in the synchronized block! while (i.hasNext()) foo(i.next()); }
public static Collection unmodifiableCollection(Collection c); public static Set unmodifiableSet(Set s); public static List unmodifiableList(List list); public static Map unmodifiableMap(Map m); public static SortedSet unmodifiableSortedSet(SortedSet s); public static SortedMap unmodifiableSortedMap(SortedMap m);
public static void sort(List list) // All elements must implement Comparable public static void sort(List list, Comparator c) public static int binarySearch(List list, Object key) // All elements must implement Comparable public static int binarySearch(List list, Object key, Comparator c) public static void reverse(List l) public static void shuffle(List list) public static void fill(List list, Object o) // Sets all elements to be given object public static void copy (List dest, List src) public static Object min[max](Collection coll) // All elements must implement Comparable public static Object min[max](Collection coll, Comparator comp)
public interface ITag { public void init( String name ); public String getName(); public Object getAttribute( String name ); public Iterator getAttributes(); public Iterator getAttributeNames(); public Iterator getChildren(); public void addAttribute( String name, Object value ); public Object getObject(); public void build( ITag parent ) throws ParseException; }
<RESOURCE CLASS=edu.nyu.sejava.iskold.eworld.HomogeneousResource> <PROPERTY NAME=Quantity VALUE=25> <PROPERTY NAME=Base VALUE=a> <PROPERTY NAME=Renewable VALUE=true> </RESOURCE>