@Contract(value = "null -> null; !null -> !null", mutates = "param1")
  public static <T> List<T> trimToSize(@Nullable List<T> list) {
    if (list == null) return null;
    if (list.isEmpty()) return emptyList();

    if (list instanceof ArrayList) {
      ((ArrayList<T>)list).trimToSize();
    }

    return list;
  }
@Contract(value = "null -> null; !null -> !null", mutates = "param1")
  public static <T> List<T> trimToSize(@Nullable List<T> list)