Returns a new set with @Default and @Any added as needed
@return
968362
public static Set<Annotation> buildQualifiers(Set<Annotation> annotations) {
        Set<Annotation> qualifiers = new HashSet<Annotation>(annotations);
        if (annotations.isEmpty()) {
            qualifiers.add(DefaultLiteral.INSTANCE);
        }
        qualifiers.add(AnyLiteral.INSTANCE);
        return qualifiers;
    }
562142
public Set<String> getExpand()
	{
		List<String> values = parameters.get(WQUriControlField.EXPAND.getName());

		if (values == null || values.isEmpty())
			return Collections.singleton("all");
		else
			return new HashSet<>(values);
	}
672323
public static <T> Set<T> asImmutable(Set<T> self) {
        return asUnmodifiable(new LinkedHashSet<T>(self));
    }
957379
public static <G extends PartiallyOrdered<?>> Context powerset(final List<G> set) {
        return new Context(set, set, new NotEqual());
    }
1099761
public static <T> Set<T> toImmutableSet(final Set<? extends T> set) {
    switch (set.size()) {
      case 0:
        return Collections.emptySet();
      case 1:
        return Collections.singleton(set.iterator().next());
      default:
        return Collections.unmodifiableSet(set);
    }
  }
475958
public static <T> Collector<T, Set<T>, Set<T>> toSet() {
    return Collector.of(
      HashSet::new,
      Set::add,
      (left, right) -> {
        left.addAll(right);
        return left;
      },
      ImmutableSet::copyOf);
  }
1184621
public static <E, S extends Set<E>> UnmodifiableMutableSet<E> of(S set)
    {
        if (set == null)
        {
            throw new IllegalArgumentException("cannot create an UnmodifiableMutableSet for null");
        }
        return new UnmodifiableMutableSet<E>(SetAdapter.adapt(set));
    }
60676
function createSet(values) {
    var set = new Set();
    Lazy(values || []).flatten().each(function(e) {
      set.add(e);
    });
    return set;
  }
905786
@Override
  public Set<Map.Entry<K,V>> entrySet() {
    return new AbstractSet<Map.Entry<K,V>>() {
      @Override
      public Iterator<Map.Entry<K,V>> iterator() {
        Filter<Map.Entry<K,V>> filter1 = new Filter<Map.Entry<K,V>>() {
          private static final long serialVersionUID = 1L;

          // only accepts stuff not overwritten by deltaMap
          public boolean accept(Map.Entry<K,V> e) {
            K key = e.getKey();
            return ! deltaMap.containsKey(key);
          }
        };

        Iterator<Map.Entry<K, V>> iter1 = new FilteredIterator<Map.Entry<K, V>>(originalMap.entrySet().iterator(), filter1);

        Filter<Map.Entry<K,V>> filter2 = new Filter<Map.Entry<K,V>>() {
          private static final long serialVersionUID = 1L;
          // only accepts stuff not overwritten by deltaMap
          public boolean accept(Map.Entry<K,V> e) {
            Object value = e.getValue();
            if (value == removedValue) {
              return false;
            }
            return true;
          }
        };

        class NullingIterator<K, V> implements Iterator<Map.Entry<K,V>> {
          private Iterator<Map.Entry<K, V>> i;

          public NullingIterator(Iterator<Map.Entry<K, V>> i) {
            this.i = i;
          }

          public boolean hasNext() {
            return i.hasNext();
          }

          public Map.Entry<K, V> next() {
            Map.Entry<K,V> e = i.next();
            Object o = e.getValue();
            if (o == nullValue) {
              return new SimpleEntry<K,V>(e.getKey(), null);
            }
            return e;
          }

          public void remove() {
            throw new UnsupportedOperationException();
          }
        }

        Iterator<Entry<K, V>> iter2 = new FilteredIterator<Entry<K,V>>(new NullingIterator<K, V>(deltaMap.entrySet().iterator()), filter2);

        return new ConcatenationIterator<Entry<K,V>>(iter1, iter2);
      }

      @Override
      public int size() {
        int size = 0;
        for (Entry<K, V> kvEntry : this) {
          ErasureUtils.noop(kvEntry);
          size++;
        }
        return size;
      }
    };
  }
568813
@Override
    public Set keySet() {
        if (keySet != null) {
            return keySet;
        }
        keySet = new AbstractSet() {
            @Override
            public Iterator iterator() {
                return new KeyIterator();
            }            @Override
            public int size() {
                return size;
            }



            @Override
            public boolean contains(final Object o) {
                return containsKey(o);
            }


            @Override
            public boolean remove(final Object o) {
                final Object r = ReferenceMap.this.remove(o);
                return r != null;
            }

            @Override
            public void clear() {
                ReferenceMap.this.clear();
            }

        };
        return keySet;
    }
589626
@Override
    public Set<Map.Entry<K, V>> entrySet() {
        return new AbstractSet<Map.Entry<K, V>>() {
            @Override
            public Iterator<Map.Entry<K, V>> iterator() {
                return new ObjIterator<Map.Entry<K, V>>() {
                    private final Iterator<Map.Entry<K, V>> keyValueEntryIter = keyMap.entrySet().iterator();

                    @Override
                    public boolean hasNext() {
                        return keyValueEntryIter.hasNext();
                    }

                    @Override
                    public Map.Entry<K, V> next() {
                        final Map.Entry<K, V> entry = keyValueEntryIter.next();

                        return new Map.Entry<K, V>() {
                            @Override
                            public K getKey() {
                                return entry.getKey();
                            }

                            @Override
                            public V getValue() {
                                return entry.getValue();
                            }

                            @Override
                            public V setValue(V value) {
                                //    if (N.equals(entry.getValue(), value)) {
                                //        return entry.getValue();
                                //    }
                                //
                                //    //    if (valueMap.containsKey(value)) {
                                //    //        throw new IllegalStateException("Value: " + N.toString(value) + " already existed.");
                                //    //    }
                                //
                                //    valueMap.remove(entry.getValue());
                                //    valueMap.put(value, entry.getKey());
                                //    return entry.setValue(value);

                                throw new UnsupportedOperationException();
                            }
                        };
                    }
                };
            }

            @Override
            public int size() {
                return keyMap.size();
            }
        };
    }
162234
final protected Set common_entrySet() {
        HashSet hs = new HashSet();
        Enumeration vEnum = cache.getAllIds();
        while (vEnum.hasMoreElements()) {
            Object key = vEnum.nextElement();
            hs.add(new DMIEntry(key, get(key)));
        }
        return hs;
    }
700175
public final Set<K> keySet() {
	return new AbstractSet<K>() {
	    public Iterator<K> iterator() {
		final Iterator<Map.Entry<K,V>> ite = entryIterator();
		return new Iterator<K>() {
		    public boolean hasNext() { return ite.hasNext(); }
		    public void    remove()  { ite.remove(); }
		    public K       next()    { return ite.next().getKey(); }
		};
	    }
	    public int size() {
		return size;
	    }
	};
    }
203197
public Set<T> internAll(Set<T> s) {
    Set<T> result = Generics.newHashSet();
    for (T o : s) {
      result.add(intern(o));
    }
    return result;
  }
291007
public Set<String> getSupportedTypes(){
		Set<String> typeset = new HashSet<String>();
		Set<String> set = factory.DefaultLabelAlphabet().toSet();
		Iterator<String> itt = set.iterator();
		while(itt.hasNext()){
			String type = itt.next();
			if(type.length() ==1 )
				continue;
			typeset.add(type.substring(1));
		}
		return typeset;
	}
574615
public Set<E> asSet ()
    {
        return new AbstractSet<E>() {
            @Override public boolean add (E o) {
                throw new UnsupportedOperationException();
            }
            @Override public boolean remove (Object o) {
                throw new UnsupportedOperationException();
            }
            @Override public boolean contains (Object o) {
                if (!(o instanceof DSet.Entry)) {
                    return false;
                }
                @SuppressWarnings("unchecked") E elem = (E)o;
                return DSet.this.contains(elem);
            }
            @Override public Iterator<E> iterator () {
                return DSet.this.iterator();
            }
            @Override public int size () {
                return DSet.this.size();
            }
        };
    }
1204350
@SuppressWarnings(
	{ "unchecked" })
	public static <T> Set<T> toSet(T...args)
	{
		if(args == null || args.length ==0)
			return null;
		
		HashSet<T> set = new HashSet<>(args.length);
		
		fill(set,args);
		return set;
	}