I'm starting to learn Genericsfor Java and I read several tutorials, but I'm a bit confused and not sure how a generic method is declared.
When I use a generic type, what is the correct order to define the method? I found this sample, when do I need to use the angle brackets and when not?
public class Box<A> {
private A a;
...
public void setA(A a) {
this.a = a;
}
public <A> List<A> transform(List<A> in) {
return null;
}
public static <A> A getFirstElement(List<A> list) {
return null;
}
public A getA() {
return a;
}