class Lists {

  public static <E> List<E> ensureMutable(List<E> list) {
    if (list instanceof ArrayList) return list;
    int size = list.size();
    ArrayList<E> mutable = new ArrayList<>(size);
    for (int i = 0; i < size; i++) {
      mutable.add(list.get(i));
    }
    return mutable;
  }

    Lists();

}