Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Collection;

public class Main {
    public static <O> boolean safeAddAll(Collection<O> c, Collection<? extends O> items) {
        try {
            return c.addAll(items);
        } catch (Throwable ex) {
            return false;
        }
    }

    public static <O, P extends O> boolean safeAddAll(Collection<O> c, P[] items) {
        try {
            for (O item : items) {
                c.add(item);
            }

            return true;
        } catch (Throwable ex) {
            return false;
        }
    }
}