- Timestamp:
- Jul 12, 2008, 2:14:23 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/ablib/src/Classes/System/Collections/Generic/Dictionary.ab
r410 r537 40 40 41 41 Virtual Function Item(key As Key) As T 42 If Object.ReferenceEquals(key, Nothing) Then42 If ActiveBasic.IsNothing(key) Then 43 43 Throw New ArgumentNullException("key") 44 44 End If … … 61 61 62 62 Virtual Sub Item(key As Key, value As T) 63 If Object.ReferenceEquals(key, Nothing) Then 64 'Throw ArgumentNullError 65 Exit Sub 63 If ActiveBasic.IsNothing(key) Then 64 Throw New ArgumentNullException("key") 66 65 End If 67 66 … … 100 99 'Methods 101 100 Sub Add(key As Key, value As T) 102 If Object.ReferenceEquals(key, Nothing) Then 103 'Throw ArgumentNullError 104 Exit Sub 101 If ActiveBasic.IsNothing(key) Then 102 Throw New ArgumentNullException("key") 105 103 End If 106 104 … … 108 106 Dim a = al[hash] As ArrayList 109 107 110 If Object.ReferenceEquals(a, Nothing) Then108 If ActiveBasic.IsNothing(a) Then 111 109 a = New ArrayList 112 110 al[hash] = a … … 142 140 ' End Function 143 141 ' Function GetEnumerator() As Enumerator 144 ' Function Remove(key As Key) As Boolean 145 ' End Function 142 143 /*! 144 @biref 指定されたキーの要素を削除する。 145 @date 2008/07/11 146 @param[in] key 削除対象のキー 147 @retval True 対象要素が見つかって削除されたとき 148 @retval False 見つからず削除されなかったとき 149 @author Egtra 150 */ 151 Function Remove(key As Key) As Boolean 152 Remove = False 153 If Not ActiveBasic.IsNothing(key) Then 154 Dim hash = getHash(key) 155 Dim a = al[hash] As ArrayList 156 If Not ActiveBasic.IsNothing(a) Then 157 Dim i As Long 158 For i = 0 To ELM(a.Count) 159 Dim pair = a[i] As Detail.Pair 160 If pair.Key.Equals(key) Then 161 a.RemoveAt(i) 162 Remove = True 163 count-- 164 Exit Function 165 End If 166 Next 167 End If 168 End If 169 End Function 170 146 171 ' Function TryGetValue(key As Key, ByRef value As T) As Boolean 147 172 ' End Function
Note:
See TracChangeset
for help on using the changeset viewer.