Skip to content

Commit

Permalink
fix: fixed an implementation error in WeakHashSet
Browse files Browse the repository at this point in the history
Please check tests in WeakHashSetTest
  • Loading branch information
ShellWen committed Dec 25, 2023
1 parent e0cf0f6 commit fe85155
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/src/main/java/com/osfans/trime/util/WeakHashSet.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class WeakHashSet<T> : MutableSet<T> {

override fun iterator(): MutableIterator<T> = core.keys.iterator()

override fun add(element: T) = core.put(element, PlaceHolder) != null
override fun add(element: T) = core.put(element, PlaceHolder) == null

override fun addAll(elements: Collection<T>) = elements.all(::add)

Expand Down

0 comments on commit fe85155

Please sign in to comment.