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)
| 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()) { |