获取集合中指定下标的元素值，下标可以为负数，例如-1表示最后一个元素<br>
如果元素越界，返回null

@param <T> 元素类型
@param collection 集合
@param index 下标，支持负数
@return 元素值
@since 4.0.6
482554
public static <T> T get(Collection<T> collection, int index) {
		if (null == collection) {
			return null;
		}

		final int size = collection.size();
		if (index < 0) {
			index += size;
		}

		// 检查越界
		if (index >= size) {
			return null;
		}

		if (collection instanceof List) {
			final List<T> list = ((List<T>) collection);
			return list.get(index);
		} else {
			int i = 0;
			for (T t : collection) {
				if (i > index) {
					break;
				} else if (i == index) {
					return t;
				}
				i++;
			}
		}
		return null;
	}
337227
@SuppressWarnings({ "unchecked", "rawtypes" })
	public static <T> Collection<T> create(Class<?> collectionType) {
		Collection<T> list = null;
		if (collectionType.isAssignableFrom(AbstractCollection.class)) {
			// 抽象集合默认使用ArrayList
			list = new ArrayList<>();
		}

		// Set
		else if (collectionType.isAssignableFrom(HashSet.class)) {
			list = new HashSet<>();
		} else if (collectionType.isAssignableFrom(LinkedHashSet.class)) {
			list = new LinkedHashSet<>();
		} else if (collectionType.isAssignableFrom(TreeSet.class)) {
			list = new TreeSet<>();
		} else if (collectionType.isAssignableFrom(EnumSet.class)) {
			list = (Collection<T>) EnumSet.noneOf((Class<Enum>) ClassUtil.getTypeArgument(collectionType));
		}

		// List
		else if (collectionType.isAssignableFrom(ArrayList.class)) {
			list = new ArrayList<>();
		} else if (collectionType.isAssignableFrom(LinkedList.class)) {
			list = new LinkedList<>();
		}

		// Others，直接实例化
		else {
			try {
				list = (Collection<T>) ReflectUtil.newInstance(collectionType);
			} catch (Exception e) {
				throw new UtilException(e);
			}
		}
		return list;
	}
435693
public static int[] toArray(final Collection<Integer> collection) {
        Objects.requireNonNull(collection);
        
        final int size = collection.size();
        final int[] array = new int[size];
        
        int i=0;
        for(Integer value : collection) {
            array[i] = value;
            i++;
        }
        
        return array;
    }
619102
public V get(K key, int index) {
		final Collection<V> collection = get(key);
		return CollUtil.get(collection, index);
	}
1364949
@Pure
	public P getElementAt(int index) {
		if (index >= 0) {
			int idx = 0;
			int eIdx;
			for (final GridCell<P> cell : getGridCells()) {
				eIdx = idx + cell.getReferenceElementCount();
				if (index < eIdx) {
					try {
						return cell.getElementAt(index - idx);
					} catch (IndexOutOfBoundsException exception) {
						throw new IndexOutOfBoundsException(Integer.toString(index));
					}
				}
				idx = eIdx;
			}
		}
		throw new IndexOutOfBoundsException(Integer.toString(index));
	}
464505
public static long[] toLongArray(Collection<Long> collection) {
        long[] collectionArray = new long[collection.size()];
        int index = 0;
        for (Long item : collection) {
            collectionArray[index++] = item;
        }
        return collectionArray;
    }
718070
public static <T> T getFirst(Collection<T> collection) {
		if (isEmpty(collection)) {
			return null;
		}
		if (collection instanceof List) {
			return ((List<T>) collection).get(0);
		}
		return collection.iterator().next();
	}
467903
private static <T> T get(ListIterator<? extends T> i, int index) {
        T obj = null;
        int pos = i.nextIndex();
        if (pos <= index) {
            do {
                obj = i.next();
            } while (pos++ < index);
        } else {
            do {
                obj = i.previous();
            } while (--pos > index);
        }
        return obj;
    }
204610
public static Class<?>[] toClassArray(Collection<Class<?>> collection) {
		if (collection == null) {
			return null;
		}
		return collection.toArray(new Class<?>[collection.size()]);
	}
720417
@SuppressWarnings("unchecked")
  public static Object getElement(Object iterable, int index) {
    if (iterable.getClass().isArray())
      return getElementFromArrary(iterable, index);
    if (iterable instanceof Collection)
      return getElementFromCollection((Collection<Object>) iterable, index);

    return null;
  }
620675
public static <T> List<T> convertCollectionToList(final Collection<T> collection) {

        if(List.class.isAssignableFrom(collection.getClass())) {
            return (List<T>)collection;
        }

        return new ArrayList<>(collection);

    }
1053936
public Object get (Object array, int index)
    {
        return (array == null) ? null : Array.get(array, index);
    }
449787
public function getCollection($index)
    {
        return array_key_exists($index, $this->collections)
            ? $this->collections[$index]
            : null;
    }
1319419
public static <T> List<T> getReversed(Collection<T> collection) {
        List<T> reversedList = new ArrayList<>(collection);
        Collections.reverse(reversedList);
        return reversedList;
    }
906986
@SuppressWarnings("unchecked")
	public static <T> List<T> getAny(Collection<T> collection, int... indexes) {
		final int size = collection.size();
		final ArrayList<T> result = new ArrayList<>();
		if (collection instanceof List) {
			final List<T> list = ((List<T>) collection);
			for (int index : indexes) {
				if (index < 0) {
					index += size;
				}
				result.add(list.get(index));
			}
		} else {
			Object[] array = ((Collection<T>) collection).toArray();
			for (int index : indexes) {
				if (index < 0) {
					index += size;
				}
				result.add((T) array[index]);
			}
		}
		return result;
	}
1091852
public String joinEx(Object collection, String delim, String prefix, String suffix) {
		if (collection == null) {
			return StringUtils.collectionToDelimitedString(Collections.emptyList(), delim, prefix, suffix);
		} else if (collection instanceof Collection) {
			return StringUtils.collectionToDelimitedString((Collection<?>) collection, delim, prefix, suffix);
		} else if (collection.getClass().isArray()) {
			return StringUtils.collectionToDelimitedString(CollectionUtils.arrayToList(collection), delim, prefix, suffix);
		} else {
			return StringUtils.collectionToDelimitedString(Collections.singletonList(collection), delim, prefix, suffix);
		}
	}
231037
public Object remove(int index) {
        if (index < 0 || index >= values.size()) {
            return null;
        }
        return values.remove(index);
    }