Returns unmodifiable MapSet.
@param <K>
@param <V>
@param set
@return
184873
public static final <K,V> MapSet<K,V> unmodifiableMapSet(MapSet<K,V> set)
    {
        return new UnmodifiableMapSet(set);
    }
995510
public static <K, V> Map<K, V> unmodifiableMap(final Map<? extends K, ? extends V> m) {
		return Collections.unmodifiableMap(m);
	}
898332
@Inline(value="$2.$3copyOf($1)", imported=ImmutableSet.class)
	public static <T> Set<T> immutableCopy(Set<? extends T> set) {
		return ImmutableSet.copyOf(set);
	}
152516
public Set<E> getSubSet(int k) {
        int from = -1;
        //TODO: very bad. Bounds should be memorized
        for (int x = 0; x < values.size(); x++) {
            int cIdx = index.get(values.get(x).id());
            if (cIdx == k && from == -1) {
                from = x;
            }
            if (from >= 0 && cIdx > k) {
                return new ElementSubSet<>(this, k, from, x);
            }
        }
        if (from >= 0) {
            return new ElementSubSet<>(this, k, from, values.size());
        }
        return Collections.emptySet();
    }
760930
public final Set<Map.Entry<K,V>> entrySet() {

	return new AbstractSet<Map.Entry<K,V>>() {
	    public Iterator<Map.Entry<K,V>> iterator() {
		return entryIterator();
	    }
	    public int size() {
		return size;
	    }
	};
    }
369390
@Override
    public Set<K> keySet() {
        try {
            lockAllSegments();
            Set<K> set = new HashSet<>();
            for (LinkedHashMapSegment<K, V> seg : segments) {
                set.addAll(seg.keySet());
            }
            return set;
        } finally {
            unlockAllSegments();
        }
    }
252775
public static <T> Set<T> intersection(Set<T>... sets) {
		return intersection(Arrays.asList(sets));
	}
239822
public static <T> Set<T> getRandomSubset(Set<T> set) {
		return getRandomSubsetMax(set, set.size());
	}
1150530
public static <T> Set<T> unmodifiableSet(Set<? extends T> s) {
		return Collections.unmodifiableSet(s);
	}
1200866
public static final <T> Set<T> intersection(Collection<Set<T>> sets)
    {
        Set<T> set = union(sets);
        for (Set<T> s : sets)
        {
            set.retainAll(s);
        }
        return set;
    }
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);
    }
  }
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();
            }
        };
    }
925194
public Map<ElementDescriptor<?>, Object> getSet()
	{
		return mSet == null ? null : Collections.unmodifiableMap(mSet);
	}
62406
public final Set<K> keySet() {
		try {
			Set<K> set = new HashSet<K>();
			listFilesToSet(getPath(), set);
			return set;
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
691954
public static final <S, E> Functional<S> functionalSet(Set<E> set) {
		return new FunctionalSet<S, E>(set);
	}
1198141
public Map<K, V> getMap() {
        if (mode == StorageMode.LIST) {
            synchronized (this) {
                if (mode == StorageMode.LIST) {
                    mapData = convertListToMap(listData);
                    mode = StorageMode.BOTH;
                }
            }
        }
        return Collections.unmodifiableMap(mapData);
    }
1187086
public Set<Map.Entry<K,V>> entrySet ()
    {
        // no modifying except through put() and remove()
        return Collections.unmodifiableSet(_delegate.entrySet());
    }