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

Method one

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

getChoice. @param a T object. @param message a java.lang.String object. @param choices a T object. @return a T object.

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

Source from the content-addressed store, hash-verified

62 * @return a T object.
63 */
64 public static <T> void one(final String message, final T[] choices, final Consumer<T> callback) {
65 if (choices == null || choices.length == 0) {
66 callback.accept(null);
67 return;
68 }
69 if (choices.length == 1) {
70 callback.accept(choices[0]);
71 return;
72 }
73
74 getChoices(message, 1, 1, choices, result -> {
75 assert result.size() == 1;
76 callback.accept(result.get(0));
77 });
78 }
79
80 public static <T> void one(final String message, final Collection<T> choices, final Consumer<T> callback) {
81 if (choices == null || choices.isEmpty()) {

Callers 2

runMethod · 0.95
selectMethod · 0.95

Calls 6

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

Tested by

no test coverage detected