• Post Reply Bookmark Topic Watch Topic
  • New Topic

signature of replaceAll function in java.util.Collections class  RSS feed

 
amit kumararya
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am confused with the following function signature in the class java.util.Collections.



i got the other parts but i could not figure out at all what is the meaning of <T> in the beginning.

someone please help.
 
Mike. J. Thompson
Bartender
Posts: 689
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is declaring the generic type 'T'. Without that declaration the compiler would not know what 'T' was.

You often see the generic type parameter as part of the class declaration, but this is how you do it for just a single method.
 
amit kumararya
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot mike...
 
Campbell Ritchie
Marshal
Posts: 56534
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So you go to the Java Tutorials and you search for generic method and you find this, which should provide lots more information.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!