util-common/src/main/java/io/activej/common/Utils.java
/**
	 * Returns an intersection of two sets
	 * <p>
	 * No guarantee on a mutability of a resulting set is made,
	 * so set should be considered unmodifiable
	 * <p>
	 * If any of provided sets is modified, the behaviour of a resulting set is undefined
	 */
Returns an intersection of two sets

No guarantee on a mutability of a resulting set is made,
so set should be considered unmodifiable

If any of provided sets is modified, the behaviour of a resulting set is undefined
Returns an intersection of two sets No guarantee on a mutability of a resulting set is made so set should be considered unmodifiable If any of provided sets is modified the behaviour of a resulting set is undefined
public static <T> Set<T> intersection(Set<? extends T> a, Set<? extends T> b) {
		return a.size() < b.size() ?
				a.stream().filter(b::contains).collect(toSet()) :
				b.stream().filter(a::contains).collect(toSet());
	}
public static < T > Set < T > intersection ( Set < ? extends T > a , Set < ? extends T > b ) { return a . size ( ) < b . size ( ) ? a . stream ( ) . filter ( b :: contains ) . collect ( toSet ( ) ) : b . stream ( ) . filter ( a :: contains ) . collect ( toSet ( ) ) ; }
Returns an intersection of two sets
 <p>
 No guarantee on a mutability of a resulting set is made,
 so set should be considered unmodifiable
 <p>
 If any of provided sets is modified, the behaviour of a resulting set is undefined
Returns an intersection of two sets <p > No guarantee on a mutability of a resulting set is made so set should be considered unmodifiable <p > If any of provided sets is modified the behaviour of a resulting set is undefined