Remove truePredicate/falsePredicate/emptyConsumer

This commit is contained in:
yushijinhun 2018-09-22 12:39:57 +08:00
parent b33e014f71
commit ed91771594
No known key found for this signature in database
GPG Key ID: 5BC167F73EA558E4
4 changed files with 3 additions and 18 deletions

View File

@ -23,7 +23,6 @@ import org.jackhuang.hmcl.download.DefaultDependencyManager;
import org.jackhuang.hmcl.download.GameBuilder;
import org.jackhuang.hmcl.game.DefaultGameRepository;
import org.jackhuang.hmcl.task.Task;
import org.jackhuang.hmcl.util.Constants;
import org.jackhuang.hmcl.util.gson.JsonUtils;
import org.jackhuang.hmcl.util.io.FileUtils;
@ -93,7 +92,7 @@ public final class CurseInstallTask extends Task {
} catch (JsonParseException | IOException ignore) {
}
this.config = config;
dependents.add(new ModpackInstallTask<>(zipFile, run, manifest.getOverrides(), Constants.truePredicate(), config));
dependents.add(new ModpackInstallTask<>(zipFile, run, manifest.getOverrides(), any -> true, config));
}
@Override

View File

@ -100,7 +100,7 @@ public final class MultiMCModpackInstallTask extends Task {
} catch (JsonParseException | IOException ignore) {
}
dependents.add(new ModpackInstallTask<>(zipFile, run, "/" + manifest.getName() + "/minecraft", Constants.truePredicate(), config));
dependents.add(new ModpackInstallTask<>(zipFile, run, "/" + manifest.getName() + "/minecraft", any -> true, config));
}
@Override

View File

@ -17,7 +17,6 @@
*/
package org.jackhuang.hmcl.task;
import org.jackhuang.hmcl.util.Constants;
import org.jackhuang.hmcl.util.Logging;
import java.util.concurrent.*;
@ -113,7 +112,7 @@ public final class Schedulers {
return newThread();
}
static final Scheduler NONE = new SchedulerImpl(Constants.emptyConsumer());
static final Scheduler NONE = new SchedulerImpl(any -> {});
public static synchronized void shutdown() {
Logging.LOG.info("Shutting down executor services.");

View File

@ -27,7 +27,6 @@ import org.jackhuang.hmcl.util.platform.OperatingSystem;
import java.awt.*;
import java.nio.charset.Charset;
import java.util.function.Consumer;
import java.util.function.Predicate;
/**
* Constants.
@ -63,16 +62,4 @@ public final class Constants {
// lazy loading
public static final ObjectBinding<Image> DEFAULT_ICON = Bindings.createObjectBinding(() -> new Image("/assets/img/icon.png"));
public static <T> Predicate<T> truePredicate() {
return s -> true;
}
public static <T> Predicate<T> falsePredicate() {
return s -> false;
}
public static <T> Consumer<T> emptyConsumer() {
return x -> {};
}
}