Saturday, 7 September 2013

Scala: Declaring method with generic type parameter

Scala: Declaring method with generic type parameter

What is the equivalent of the following Java method declaration in Scala:
public <T> T readValue(java.lang.String s, java.lang.Class<T> tClass)
In other words, I'd like to declare a method that takes a class of type T,
and returns an instance of that type.

No comments:

Post a Comment