From d08b45018c093458f683ee93ea5f972e57886aa9 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Thu, 20 May 2021 06:33:07 -0400 Subject: [PATCH] Simpler ContainsValue --- BeefLibs/corlib/src/Collections/Dictionary.bf | 20 ++----------------- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/BeefLibs/corlib/src/Collections/Dictionary.bf b/BeefLibs/corlib/src/Collections/Dictionary.bf index 9789c46d..7313d931 100644 --- a/BeefLibs/corlib/src/Collections/Dictionary.bf +++ b/BeefLibs/corlib/src/Collections/Dictionary.bf @@ -258,25 +258,9 @@ namespace System.Collections public bool ContainsValue(TValue value) { - if (value == null) + for (int_cosize i = 0; i < mCount; i++) { - for (int_cosize i = 0; i < mCount; i++) - { - if (mEntries[i].mHashCode >= 0 && mEntries[i].mValue == null) return true; - } - } - else - { - for (int_cosize i = 0; i < mCount; i++) - { - if (mEntries[i].mHashCode >= 0 && mEntries[i].mValue == value) return true; - } - //TODO: comparison - /*EqualityComparer c = EqualityComparer.Default; - for (int i = 0; i < count; i++) - { - if (entries[i].hashCode >= 0 && c.Equals(entries[i].value, value)) return true; - }*/ + if (mEntries[i].mHashCode >= 0 && mEntries[i].mValue == null) return true; } return false; }