Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.*;

public class Main {
    public static <T> void addIfNotNull(final Collection<T> collection, final T item) {
        if (item != null) {
            collection.add(item);
        }
    }

    public static <K, V extends List> void addIfNotNull(final Map<K, V> map, final K key, final V valueList) {
        if (valueList != null && !valueList.isEmpty()) {
            map.put(key, valueList);
        }
    }
}