MCPcopy Create free account
hub / github.com/Card-Forge/forge / oneOrNone

Method oneOrNone

forge-gui-mobile/src/forge/toolbox/GuiChoose.java:34–40  ·  view source on GitHub ↗

Convenience for getChoices(message, 0, 1, choices). @param is automatically inferred. @param message a java.lang.String object. @param choices a T object. @return null if choices is missing, empty, or if the users' choices are empty; otherwise, r

(final String message, final T[] choices, final Consumer<T> callback)

Source from the content-addressed store, hash-verified

32 * @see #getChoices(String, int, int, Object...)
33 */
34 public static <T> void oneOrNone(final String message, final T[] choices, final Consumer<T> callback) {
35 if ((choices == null) || (choices.length == 0)) {
36 callback.accept(null);
37 return;
38 }
39 getChoices(message, 0, 1, choices, result -> callback.accept(result.isEmpty() ? null : result.get(0)));
40 }
41
42 public static <T> void oneOrNone(final String message, final Collection<T> choices, final Consumer<T> callback) {
43 if ((choices == null) || choices.isEmpty()) {

Callers 7

startMatchMethod · 0.95
startMatchMethod · 0.95
createGauntletContestMethod · 0.95
getIntegerMethod · 0.95
buildMenuMethod · 0.95
buildMenuMethod · 0.95
handleReplaceCardMethod · 0.95

Calls 4

getChoicesMethod · 0.95
isEmptyMethod · 0.65
getMethod · 0.65
acceptMethod · 0.45

Tested by

no test coverage detected