.
This commit is contained in:
parent
3575de589b
commit
1589ed92d7
@ -76,6 +76,8 @@ import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class MUtil
|
||||
@ -1747,6 +1749,18 @@ public class MUtil
|
||||
{
|
||||
return equalsishNumber(number1, number2);
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// SET IF DIFFERENT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static <T> boolean setIfDifferent(T value, Supplier<T> getter, Consumer<T> setter)
|
||||
{
|
||||
T currentVal = getter.get();
|
||||
if (currentVal == value) return false;
|
||||
setter.accept(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// SORTING
|
||||
|
Loading…
Reference in New Issue
Block a user