#Generics naming confusion
21 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @crimson grotto! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
because T is not defined in the second example
So you ALWAYS have to declare BEFORE the return value what generic types exist?
If its a static method, or the method needs its own generics you have to declare it before the return value. If the method is not static and doesn't need its own generics but can use the generic type of the class you don't need to declare any additional generics.
I don't actually understand your second question. What do you mean by what generic types exist?
That was meant as one question sorry.
I meant that I have to define which generics I want to use before the method name
Ah well yes only the method is static here
yeah all static methods have to define their own generics
I just did not know you have to define the generic at one point (or whatever you call the T here)
well if you don't define the generic java has no idea what you are talking about xD
Thats....true
I am so overworked by the tasks this week I get everything wrong I possibly can : D
Thanks (once again this week :D)!
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
I helped you this week ?
Yesterday
oh shit i forgot
The IDE thing
oh yeah. Well if you have questions feel free to send them here 🙂