Reputation: 2320
Why does
var = java.util.List
println var
results in following output: interface java.util.List
?
I would expect java.util.List
to be printed instead. How can I achieve that?
Upvotes: 1
Views: 22
Reputation: 45309
The value you're seeing is the output of Class.toString()
. If you need just the name, you can retrieve it using getName()
println var.getName()
Or, groovier:
println var.name
Both of which print java.util.List
. getName()
returns the fully-qualified name of the type, and would omit the class type added by the toString()
method.
Upvotes: 1