|
|
@@ -6,14 +6,15 @@
|
|
|
*/
|
|
|
package net.ranides.assira.collection.sets;
|
|
|
|
|
|
-import java.io.Serializable;
|
|
|
-import java.util.Set;
|
|
|
-import java.util.function.IntUnaryOperator;
|
|
|
import lombok.experimental.UtilityClass;
|
|
|
import net.ranides.assira.collection.iterators.IntIterator;
|
|
|
import net.ranides.assira.collection.iterators.IntIteratorUtils;
|
|
|
import net.ranides.assira.functional.covariant.IntProjectionFunction;
|
|
|
|
|
|
+import java.io.Serializable;
|
|
|
+import java.util.Set;
|
|
|
+import java.util.function.IntUnaryOperator;
|
|
|
+
|
|
|
/**
|
|
|
* Static methods working with Sets
|
|
|
*
|
|
|
@@ -22,6 +23,22 @@ import net.ranides.assira.functional.covariant.IntProjectionFunction;
|
|
|
@UtilityClass
|
|
|
public final class IntSetUtils {
|
|
|
|
|
|
+ private static final IntSet EMPTY = new AIntSet() {
|
|
|
+ @Override
|
|
|
+ public IntIterator iterator() {
|
|
|
+ return IntIteratorUtils.empty();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int size() {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ public static IntSet empty() {
|
|
|
+ return EMPTY;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Creates view which transforms values stored inside source set.
|
|
|
* Returned view does not support modifications.
|