I create a generic method without parameter, some thing like:
private <T> TableCell<T> createTableCell(){
return new TableCell<T>();
}
So, in my program, how to call this method for a concrete type?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Usually, the type is inferred, but you can specify the type with this syntax:
Note: You have an error in your method’s definition – it had no return type:
Here’s how you can call it:
If you method doesn’t access any fields, consider making it a
staticmethod, which you would call like:As an aside, when you use this syntax, many will marvel at your “eliteness” – it’s a syntax not often seen.