Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Collection;

import java.util.List;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;

public class Main {
    public static <T> ImmutableList<String> toStrings(Collection<T> input) {

        List<String> result = Lists.newArrayList();

        for (T current : input) {

            if (current == null)
                throw new NullPointerException("Null objects not allowed");

            result.add(current.toString());
        }

        return ImmutableList.copyOf(result);

    }
}