This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Generic Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Generic" Watch "Generic" New topic
Author

Generic

meeta gaur
Ranch Hand

Joined: Dec 05, 2012
Posts: 225

Synchronization Wrappers

The synchronization wrappers add automatic synchronization (thread-safety) to an arbitrary collection. Each of the six core collection interfaces — Collection, Set, List, Map, SortedSet, and SortedMap — has one static factory method.

public static <T> Collection<T> synchronizedCollection(Collection<T> c);
public static <T> Set<T> synchronizedSet(Set<T> s);
public static <T> List<T> synchronizedList(List<T> list);
public static <K,V> Map<K,V> synchronizedMap(Map<K,V> m);
public static <T> SortedSet<T> synchronizedSortedSet(SortedSet<T> s);
public static <K,V> SortedMap<K,V> synchronizedSortedMap(SortedMap<K,V> m);


I'm not getting these <T>.....<T> two times thing, what is this ?


OCAJP
Jesper de Jong
Java Cowboy
Bartender

Joined: Aug 16, 2005
Posts: 12913
    
    3

These are methods with type parameters. The first <T> is to indicate that the method has a type parameter named T, and the subsequent <T>s are places where the type parameter is used.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Generic
 
Similar Threads
Casting through diffrent tree branches.
Is memorizing the 6 core collection interfaces necessary
Casting in Collection
Collections class ( Generics )
java.lang.ClassCastException: Employee cannot be cast to java.lang.Comparable