Ensures that an object reference passed as a parameter to the calling method is not null. @param reference an object reference @return the non-null reference that was validated @throws NullPointerException if reference is null
(T reference)
| 821 | */ |
| 822 | |
| 823 | @CanIgnoreReturnValue |
| 824 | public static <T> T checkNotNull(T reference) { |
| 825 | if (reference == null) { |
| 826 | throw new NullPointerException(); |
| 827 | } |
| 828 | return reference; |
| 829 | } |
| 830 | |
| 831 | /** |
| 832 | * Ensures that an object reference passed as a parameter to the calling method is not null. |