Skip to content

Commit

Permalink
better impl on response proxy methods
Browse files Browse the repository at this point in the history
  • Loading branch information
onionpancakes committed Oct 14, 2023
1 parent 68c2ebb commit abc0259
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/dev/onionpancakes/hop/response.clj
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
(containsKey [this k]
(some? (.get this k)))
(containsValue [this value]
(-> (into #{} (keep #(.get this %)) response-proxy-keys)
(contains? value)))
(->> response-proxy-keys
(keep (comp #{value} #(.get this %)))
(first)
(some?)))
(entrySet [this]
(let [create-map-entry #(when-some [value (.get this %)]
(clojure.lang.MapEntry. % value))]
Expand Down Expand Up @@ -66,7 +68,7 @@
(remove [this k]
(throw (UnsupportedOperationException.)))
(size [this]
(count (filter #(.containsKey this %) response-proxy-keys)))
(count (keep #(.get this %) response-proxy-keys)))
(values [this]
(into [] (keep #(.get this %)) response-proxy-keys)))

Expand Down

0 comments on commit abc0259

Please sign in to comment.