Added default boolean suppliers
Summary: This adds boolean suppliers that can be used for default values.
package com.facebook.common.internal;
-/**
- * Wrapper for creating a Supplier.
- */
+/** Wrapper for creating a Supplier and default Suppliers for convenience. */
public class Suppliers {
/**
* Returns a Supplier which always returns {@code instance}.
@@ -26,4 +24,22 @@ public class Suppliers {
}
};
}
+
+ /** Boolean supplier that always returns true. */
+ public static final Supplier<Boolean> BOOLEAN_TRUE =
+ new Supplier<Boolean>() {
+ @Override
+ public Boolean get() {
+ return true;
+ }
+ };
+
+ /** Boolean supplier that always returns false. */
+ public static final Supplier<Boolean> BOOLEAN_FALSE =
+ new Supplier<Boolean>() {
+ @Override
+ public Boolean get() {
+ return false;
+ }
+ };
}
