@Nullable
  public static <T> T lastElement(@Nullable final List<T> list) {
    if (CollectionUtils.isEmpty(list)) {
      return null;
    }
    return list.get(list.size() - 1);
  }
@ Nullable public static < T > T lastElement ( @ Nullable final List < T > list ) { if ( CollectionUtils . isEmpty ( list ) ) { return null ; } return list . get ( list . size ( ) - 1 ) ; }
Retrieve the last element of the given List, accessing the highest index.

@param list the List to check (may be {@code null} or empty)
@return the last element, or {@code null} if none
@since 5.0.3