Browse Source

GetValueAlt

Brian Fiete 3 months ago
parent
commit
bbf057a59c
1 changed files with 7 additions and 0 deletions
  1. 7 0
      BeefLibs/corlib/src/Collections/Dictionary.bf

+ 7 - 0
BeefLibs/corlib/src/Collections/Dictionary.bf

@@ -269,6 +269,13 @@ namespace System.Collections
 			return .Err;
 			return .Err;
 		}
 		}
 
 
+		public Result<TValue> GetValueAlt<TAltKey>(TAltKey key) where TAltKey : IHashable where bool : operator TKey == TAltKey
+		{
+			int_cosize i = (int_cosize)FindEntryAlt(key);
+			if (i >= 0) return mEntries[i].mValue;
+			return .Err;
+		}
+
 		public void Clear()
 		public void Clear()
 		{
 		{
 			if (mCount > 0)
 			if (mCount > 0)