Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//     The contents of this file are subject to the Mozilla Public License

import java.util.*;

public class Main {
    /**
     *
     * Create a set out of arguments. This is as close to an object literal as you can get in Java and very similar to
     * the scala Set()
     *
     * @param targetCollection items to put in a set
     * @param <T> type of set
     * @return set of items passed as arguments
     */
    public static <T> Set<T> setFrom(Collection<T> targetCollection) {
        return new HashSet<T>(targetCollection);
    }
}