Java tutorial
//package com.java2s; //License from project: Apache License import java.util.Collection; public class Main { /** adds all items from src to dst */ public static <T> void addAll(final T[] src, final Collection<T> dst) { if (src != null) java.util.Collections.addAll(dst, src); } public static void addAll(final Collection<Long> src, final long[] dst) { if (src == null) return; int i = 0; for (final long l : src) dst[i++] = l; } public static void addAll(final long[] src, final Collection<Long> dst) { if (src == null) return; for (final long l : src) dst.add(l); } public static void addAll(final int[] src, final Collection<Integer> dst) { if (src == null) return; for (final int l : src) dst.add(l); } /** adds all items from src to dst */ public static <T> void addAll(final Collection<T> src, final Collection<T> dst) { if (src != null) dst.addAll(src); } }