Skip to content

Commit ae44c21

Browse files
committed
sort hasValue methods
1 parent 51b6053 commit ae44c21

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

json/src/main/java/alpine/json/ObjectElement.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
import java.util.function.Predicate;
1111
import java.util.stream.Stream;
1212

13+
import static alpine.json.Element.*;
14+
1315
/**
1416
* A JSON element which stores a collection of key-value pairs where the keys are strings.
1517
* @see <a href="https://datatracker.ietf.org/doc/html/rfc8259#section-4">RFC 8259</a>
@@ -181,16 +183,16 @@ public boolean hasValue(Element value) {
181183
return this.elements.containsValue(value);
182184
}
183185

184-
public boolean hasValue(String value) {
185-
return this.hasValue(Element.string(value));
186+
public boolean hasValue(boolean value) {
187+
return this.hasValue(bool(value));
186188
}
187189

188190
public boolean hasValue(Number value) {
189-
return this.hasValue(Element.number(value));
191+
return this.hasValue(number(value));
190192
}
191193

192-
public boolean hasValue(Boolean value) {
193-
return this.hasValue(Element.bool(value));
194+
public boolean hasValue(String value) {
195+
return this.hasValue(string(value));
194196
}
195197

196198
public void each(BiConsumer<String, Element> consumer) {
@@ -268,15 +270,15 @@ public ObjectElement set(String key, Element value) {
268270
}
269271

270272
public ObjectElement set(String key, boolean value) {
271-
return this.set(key, Element.bool(value));
273+
return this.set(key, bool(value));
272274
}
273275

274276
public ObjectElement set(String key, Number value) {
275-
return this.set(key, Element.number(value));
277+
return this.set(key, number(value));
276278
}
277279

278280
public ObjectElement set(String key, String value) {
279-
return this.set(key, Element.string(value));
281+
return this.set(key, string(value));
280282
}
281283

282284
public ObjectElement remove(String key) {

0 commit comments

Comments
 (0)