Gets an unmodifiable list from the given list.

@param list the list, might be {@code null}.
@return an unmodifiable list, never {@code null}.
964882
private static <T> List<T> unmodifiableList(List<T> list) {
        if (list == null) {
            return Collections.emptyList();
        }
        return Collections.unmodifiableList(list);
    }
537566
public static <E, L extends List<E>> UnmodifiableMutableList<E> of(L list)
    {
        if (list == null)
        {
            throw new IllegalArgumentException("cannot create an UnmodifiableMutableList for null");
        }
        if (list instanceof RandomAccess)
        {
            return new RandomAccessUnmodifiableMutableList<E>(RandomAccessListAdapter.adapt(list));
        }
        return new UnmodifiableMutableList<E>(ListAdapter.adapt(list));
    }
598841
public static <T, L extends List<T>> T getLast(List<T> list) {
        return isNullOrEmpty(list) ? null : list.get(list.size() - 1);
    }
1020586
@NonNull
  public static <T> List<T> immutableCopyOf(@Nullable List<T> list) {
    if (isNullOrEmpty(list)) {
      return Collections.emptyList();
    }
    return Collections.unmodifiableList(new ArrayList<>(list));
  }
285008
public static <E> E firstInList(List<E> list){
    	if (list == null || list.size() == 0){
    		return null;
    	}else{
    		return list.get(0);
    	}
    }
417233
public static <T> JSONArray listToJSONArray(final List<T> list) {
        final JSONArray ret = new JSONArray();

        if (null == list) {
            return ret;
        }

        for (final T object : list) {
            ret.put(object);
        }

        return ret;
    }
1062700
@Inline(value="$2.$3unmodifiableList($1)", imported=Collections.class)
	public static <T> List<T> unmodifiableView(List<? extends T> list) {
		return Collections.unmodifiableList(list);
	}
336019
public static final <K,V> MapList<K,V> unmodifiableMapList(MapList<K,V> map)
    {
        return new UnmodifiableMapList(Collections.unmodifiableMap(map), map.getComparator());
    }
1126632
public static <V> Map<V, V> convertListToMap(List<V> list) {
        Map<V, V> map = new HashMap<V, V>();
        if(list.size() % 2 != 0)
            throw new VoldemortException("Failed to convert list to map.");
        for(int i = 0; i < list.size(); i += 2) {
            map.put(list.get(i), list.get(i + 1));
        }
        return map;
    }
1214956
public <T> List<T> subList(List<T> list) {
        if (!list.isEmpty()) {
            int from = offset != null ? toInt(offset) : 0;
            int to = limit != null ? (from + toInt(limit)) : list.size();
            return list.subList(from, Math.min(to,list.size()));
        } else {
            return list;
        }
    }
817298
public static final <S, E> Functional<S> functionalList(List<E> list) {
		return new FunctionalList<S, E>(list); 
	}
411529
public static int[] unbox (Collection<Integer> list)
    {
        if (list == null) {
            return null;
        }
        int[] unboxed = new int[list.size()];
        int ii = 0;
        for (Integer value : list) {
            unboxed[ii++] = value;
        }
        return unboxed;
    }
771941
public static <T> List<T> createWhenNull(final List<T> list) {
        if (list == null) {
            return new ArrayList<T>();
        } else {
            return list;
        }
    }
1042468
public static <T> T getRandomItem(List<T> list) {
		return list.get(rand.nextInt(list.size()));
	}
1120800
@NonNull
    public static List<Object> unmodifiableNonNullList(@Nullable Object[] args) {
        return args == null || args.length == 0
                ? emptyList()
                : unmodifiableList(asList(args));
    }
1084567
public static <T> T randomEle(List<T> list) {
		return randomEle(list, list.size());
	}
1112053
public static <T> List<T> emptyToNull(final List<T> list) {
        if (isEmpty(list)) {
            return null;
        } else {
            return list;
        }
    }