[bisq-network/bisq] Build out 'createoffer' API method (#4559)

sqrrm notifications at github.com
Fri Oct 2 20:34:18 UTC 2020


@sqrrm commented on this pull request.



> +import java.util.Map;
+import java.util.function.Predicate;
+
+import static java.util.Arrays.stream;
+
+class NegativeNumberOptions {
+
+    private final Map<Integer, String> negativeNumberParams = new HashMap<>();
+
+    String[] removeNegativeNumberOptions(String[] args) {
+        // Cache any negative number params that will be rejected by the parser.
+        // This should be called before command line parsing.
+        for (int i = 0; i < args.length; i++) {
+            if (isNegativeNumber.test(args[i])) {
+                String param = args[i];
+                negativeNumberParams.put(i - 1, new BigDecimal(param).toString());

Wouldn't it be more natural to start the for loop at 1 then? Like `for (int i = 1; i < args.length; i++) {` since it's known that argument 0 is irrelevant and it would also make the code self explanatory.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/4559#discussion_r499037694
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20201002/501ef90c/attachment-0001.html>


More information about the bisq-github mailing list