EN
Java - @Nullable annotation in generic method result
5
points
In this short article, we would like to show how to use @Nullable annotation for generic method result in Java.
Quick solution:
package com.dirask.example;
import javax.annotation.Nullable;
public class ClassName {
// Annotation should be placed before <T>.
// |||
// vvvvvvvvv
public @Nullable <T> T methodName(/* Some arguments here ... */) {
//
// Some source code here ...
//
}
}