public static <T> List<T> insertAt(List<T> list, int pos, T t) throws IllegalArgumentException {
        if (pos < 1) {
            throw new IllegalArgumentException("pos can't be less than 1");
        }
        list.add((pos - 1), t);
        return list;
    }
(*) Insert an element at a given position into a list
java8/src/main/java/com/shekhargulati/ninetynine_problems/_01_lists/P21.java