code: public static <T> T firstValue(List<T> list) {
          if (list != null && !list.isEmpty()) {
              return list.get(0);
          }
          return null;
      }
docs: Returns the first value of a list, or null if the list is empty.
  
  @param <T> List type
  @param list Input list
  @return First value or null