×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Gerrit Viljoen
Added: Jul 21, 2014 8:19 AM
Views: 1833
  1.     public static <T> Set<T> lookup(Set<T> set, T... values) {
  2.         if (set == null) {
  3.             return Collections.EMPTY_SET;
  4.         } else if (values.length == 0) {
  5.             return Collections.EMPTY_SET;
  6.         } else {
  7.             set.addAll(Arrays.asList(values));
  8.             return Collections.unmodifiableSet(set);
  9.         }
  10.     }