mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 07:07:43 +01:00
Cleanup
This commit is contained in:
parent
f108836d1d
commit
50f9a790fd
2 changed files with 2 additions and 9 deletions
|
@ -57,9 +57,7 @@ public class OfferBook {
|
||||||
// Mostly it is the same OfferPayload but the ProtectedStorageEntry is different.
|
// Mostly it is the same OfferPayload but the ProtectedStorageEntry is different.
|
||||||
// We filter here to only add new offers if the same offer (using equals) was not already added.
|
// We filter here to only add new offers if the same offer (using equals) was not already added.
|
||||||
boolean hasSameOffer = offerBookListItems.stream()
|
boolean hasSameOffer = offerBookListItems.stream()
|
||||||
.filter(item -> item.getOffer().equals(offer))
|
.anyMatch(item -> item.getOffer().equals(offer));
|
||||||
.findAny()
|
|
||||||
.isPresent();
|
|
||||||
if (!hasSameOffer) {
|
if (!hasSameOffer) {
|
||||||
OfferBookListItem offerBookListItem = new OfferBookListItem(offer);
|
OfferBookListItem offerBookListItem = new OfferBookListItem(offer);
|
||||||
// We don't use the contains method as the equals method in Offer takes state and errorMessage into account.
|
// We don't use the contains method as the equals method in Offer takes state and errorMessage into account.
|
||||||
|
@ -99,11 +97,6 @@ public class OfferBook {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
|
||||||
private boolean isOfferWithIdInList(Offer offer) {
|
|
||||||
return offerBookListItems.stream().filter(o -> o.getOffer().getId().equals(offer.getId())).findAny().isPresent();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ObservableList<OfferBookListItem> getOfferBookListItems() {
|
public ObservableList<OfferBookListItem> getOfferBookListItems() {
|
||||||
return offerBookListItems;
|
return offerBookListItems;
|
||||||
}
|
}
|
||||||
|
|
|
@ -343,7 +343,7 @@ public class P2PDataStorage implements MessageListener, ConnectionListener, Pers
|
||||||
if (!containsKey || hasSequenceNrIncreased) {
|
if (!containsKey || hasSequenceNrIncreased) {
|
||||||
// At startup we don't have the item so we store it. At updates of the seq nr we store as well.
|
// At startup we don't have the item so we store it. At updates of the seq nr we store as well.
|
||||||
map.put(hashOfPayload, protectedStorageEntry);
|
map.put(hashOfPayload, protectedStorageEntry);
|
||||||
hashMapChangedListeners.stream().forEach(e -> e.onAdded(protectedStorageEntry));
|
hashMapChangedListeners.forEach(e -> e.onAdded(protectedStorageEntry));
|
||||||
// printData("after add");
|
// printData("after add");
|
||||||
} else {
|
} else {
|
||||||
log.trace("We got that version of the data already, so we don't store it.");
|
log.trace("We got that version of the data already, so we don't store it.");
|
||||||
|
|
Loading…
Add table
Reference in a new issue