Java examples for java.util:Set Creation
Create an unmodifiable Set
//package com.java2s; import java.util.Collections; import java.util.Set; public class Main { /**/*from w w w . jav a 2s . co m*/ * @return an <b>UNMODIFIABLE</b> Set<T> */ public static <T> Set<T> unmodifiableSet(final Set<? extends T> s) { return (s == null) ? Collections.<T> emptySet() : Collections .unmodifiableSet(s); } }