Java examples for Collection Framework:Array Length
add All varied length object array to Collection
//package com.java2s; import java.util.Collection; public class Main { public static void main(String[] argv) { Collection c = java.util.Arrays.asList("asdf", "java2s.com"); Object objs = "java2s.com"; System.out.println(addAll(c, objs)); }/*w w w . j a va 2 s . c o m*/ @SuppressWarnings({ "rawtypes", "unchecked" }) public static boolean addAll(Collection c, Object... objs) { boolean result = false; for (Object obj : objs) { result |= c.add(obj); } return result; } }