Lucene.Net
3.0.3
Lucene.Net is a .NET port of the Java Lucene Indexing Library
|
A C# emulation of the Java Hashmap More...
Inherits IDictionary< TKey, TValue >.
Inherited by Lucene.Net.Support.HashMap< TKey, TValue >.NullKeyCollection, and Lucene.Net.Support.HashMap< TKey, TValue >.NullValueCollection.
Public Member Functions | |
HashMap () | |
HashMap (IEqualityComparer< TKey > comparer) | |
HashMap (int initialCapacity) | |
HashMap (int initialCapacity, IEqualityComparer< TKey > comparer) | |
HashMap (IEnumerable< KeyValuePair< TKey, TValue >> other) | |
bool | ContainsValue (TValue value) |
IEnumerator< KeyValuePair < TKey, TValue > > | GetEnumerator () |
void | Clear () |
bool | Remove (KeyValuePair< TKey, TValue > item) |
bool | ContainsKey (TKey key) |
virtual void | Add (TKey key, TValue value) |
bool | Remove (TKey key) |
bool | TryGetValue (TKey key, out TValue value) |
Properties | |
int | Count [get] |
bool | IsReadOnly [get] |
TValue | this[TKey key] [get, set] |
ICollection< TKey > | Keys [get] |
ICollection< TValue > | Values [get] |
A C# emulation of the Java Hashmap
A Dictionary{TKey, TValue} is a close equivalent to the Java Hashmap. One difference java implementation of the class is that the Hashmap supports both null keys and values, where the C# Dictionary only supports null values not keys. Also, V Get(TKey)
method in Java returns null if the key doesn't exist, instead of throwing an exception. This implementation doesn't throw an exception when a key doesn't exist, it will return null. This class is slower than using a Dictionary{TKey, TValue}, because of extra checks that have to be done on each access, to check for null.
NOTE: This class works best with nullable types. default(T) is returned when a key doesn't exist in the collection (this being similar to how Java returns null). Therefore, if the expected behavior of the java code is to execute code based on if the key exists, when the key is an integer type, it will return 0 instead of null.
<remaks> Consider also implementing IDictionary, IEnumerable, and ICollection like Dictionary{TKey, TValue} does, so HashMap can be used in substituted in place for the same interfaces it implements. </remaks>
TKey | The type of keys in the dictionary |
TValue | The type of values in the dictionary |
Definition at line 56 of file HashMap.cs.
Lucene.Net.Support.HashMap< TKey, TValue >.HashMap | ( | ) |
Definition at line 68 of file HashMap.cs.
Lucene.Net.Support.HashMap< TKey, TValue >.HashMap | ( | IEqualityComparer< TKey > | comparer | ) |
Definition at line 72 of file HashMap.cs.
Lucene.Net.Support.HashMap< TKey, TValue >.HashMap | ( | int | initialCapacity | ) |
Definition at line 78 of file HashMap.cs.
Lucene.Net.Support.HashMap< TKey, TValue >.HashMap | ( | int | initialCapacity, |
IEqualityComparer< TKey > | comparer | ||
) |
Definition at line 84 of file HashMap.cs.
Lucene.Net.Support.HashMap< TKey, TValue >.HashMap | ( | IEnumerable< KeyValuePair< TKey, TValue >> | other | ) |
Definition at line 96 of file HashMap.cs.
|
virtual |
Definition at line 210 of file HashMap.cs.
void Lucene.Net.Support.HashMap< TKey, TValue >.Clear | ( | ) |
Definition at line 141 of file HashMap.cs.
bool Lucene.Net.Support.HashMap< TKey, TValue >.ContainsKey | ( | TKey | key | ) |
Definition at line 196 of file HashMap.cs.
bool Lucene.Net.Support.HashMap< TKey, TValue >.ContainsValue | ( | TValue | value | ) |
Definition at line 105 of file HashMap.cs.
IEnumerator<KeyValuePair<TKey, TValue> > Lucene.Net.Support.HashMap< TKey, TValue >.GetEnumerator | ( | ) |
Definition at line 115 of file HashMap.cs.
bool Lucene.Net.Support.HashMap< TKey, TValue >.Remove | ( | KeyValuePair< TKey, TValue > | item | ) |
Definition at line 167 of file HashMap.cs.
bool Lucene.Net.Support.HashMap< TKey, TValue >.Remove | ( | TKey | key | ) |
Definition at line 223 of file HashMap.cs.
bool Lucene.Net.Support.HashMap< TKey, TValue >.TryGetValue | ( | TKey | key, |
out TValue | value | ||
) |
Definition at line 237 of file HashMap.cs.
|
get |
Definition at line 183 of file HashMap.cs.
|
get |
Definition at line 188 of file HashMap.cs.
|
get |
Definition at line 274 of file HashMap.cs.
|
getset |
Definition at line 257 of file HashMap.cs.
|
get |
Definition at line 287 of file HashMap.cs.