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 <E> Set<E> toSet(Iterable<E> iterable) {
        if (iterable instanceof Set) {
            return (Set<E>) iterable;
        }
        Set<E> set = new HashSet<>();
        if (iterable != null) {
            for (E e : iterable) {
                set.add(e);
            }
        }
        return set;
    }
}