[bisq-network/bisq] Add new 'getoffer offer-id' api method (#4608)

sqrrm notifications at github.com
Wed Oct 14 21:36:18 UTC 2020


@sqrrm commented on this pull request.



> @@ -67,6 +68,16 @@ public CoreOffersService(CreateOfferService createOfferService,
         this.user = user;
     }
 
+    Offer getOffer(String id) {
+        List<Offer> offers = offerBookService.getOffers().stream()
+                .filter(o -> o.getId().equals(id))
+                .collect(Collectors.toList());

Not wrong, but it's a bit odd to make list when we're looking for one element. `.findAny()` returns an `Optional<>` which you could then do `offer.isPresent()` and `return offer.get()` making it clear we only expect to find one offer.

-- 
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/4608#pullrequestreview-508774235
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20201014/faa59501/attachment.html>


More information about the bisq-github mailing list