mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-23 23:06:39 +01:00
Add methods for boolean values
This commit is contained in:
parent
73fcf52129
commit
764614d762
1 changed files with 10 additions and 0 deletions
|
@ -45,6 +45,16 @@ public class Cookie extends HashMap<CookieKey, String> {
|
|||
}
|
||||
}
|
||||
|
||||
public void putAsBoolean(CookieKey key, boolean value) {
|
||||
put(key, value ? "1" : "0");
|
||||
}
|
||||
|
||||
public Optional<Boolean> getAsOptionalBoolean(CookieKey key) {
|
||||
return containsKey(key) ?
|
||||
Optional.of(get(key).equals("1")) :
|
||||
Optional.empty();
|
||||
}
|
||||
|
||||
public Map<String, String> toProtoMessage() {
|
||||
Map<String, String> protoMap = new HashMap<>();
|
||||
this.forEach((key, value) -> protoMap.put(key.name(), value));
|
||||
|
|
Loading…
Add table
Reference in a new issue