Here you can find the source of asSet(Collection
Parameter | Description |
---|---|
c | a parameter |
public static <T> Set<T> asSet(Collection<T> c)
//package com.java2s; import java.util.*; public class Main { /**// ww w.j a va 2 s .co m * @param c * @return a c if c is a {@link Set} or, otherwise, a {@link LinkedHashSet} * containing the elements of c */ public static <T> Set<T> asSet(Collection<T> c) { if (c instanceof Set) { return (Set<T>) c; } LinkedHashSet<T> set = new LinkedHashSet<T>(c); return set; } }