Class LinkedHashMap<TKey, TValue>
LinkedHashMap is a specialized dictionary that preserves the entry order of elements.
Like a HashMap, there can be a null
key, but it also guarantees that the enumeration
order of the elements are the same as insertion order, regardless of the number of add/remove/update
operations that are performed on it.
Implements
System.Collections.Generic.IDictionary<TKey, TValue>
System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TValue>>
System.Collections.IEnumerable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Lucene.Net.Support
Assembly: Lucene.Net.dll
Syntax
public class LinkedHashMap<TKey, TValue> : HashMap<TKey, TValue>, IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable
Type Parameters
Name | Description |
---|---|
TKey | The type of keys in the dictionary |
TValue | The type of values in the dictionary |
Remarks
Unordered Dictionaries
- System.Collections.Generic.Dictionary`2 - use when order is not important and all keys are non-null.
- HashMap<TKey, TValue> - use when order is not important and support for a null key is required.
Ordered Dictionaries
- LinkedHashMap<TKey, TValue> - use when you need to preserve entry insertion order. Keys are nullable.
- System.Collections.Generic.SortedDictionary`2 - use when you need natural sort order. Keys must be unique.
- TreeDictionary<K, V> - use when you need natural sort order. Keys may contain duplicates.
- LurchTable<TKey, TValue> - use when you need to sort by most recent access or most recent update. Works well for LRU caching.
Constructors
| Improve this Doc View SourceLinkedHashMap()
Declaration
public LinkedHashMap()
LinkedHashMap(IEnumerable<KeyValuePair<TKey, TValue>>)
Declaration
public LinkedHashMap(IEnumerable<KeyValuePair<TKey, TValue>> source)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TValue>> | source |
LinkedHashMap(IEnumerable<KeyValuePair<TKey, TValue>>, IEqualityComparer<TKey>)
Declaration
public LinkedHashMap(IEnumerable<KeyValuePair<TKey, TValue>> source, IEqualityComparer<TKey> comparer)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TValue>> | source | |
System.Collections.Generic.IEqualityComparer<TKey> | comparer |
LinkedHashMap(IEqualityComparer<TKey>)
Declaration
public LinkedHashMap(IEqualityComparer<TKey> comparer)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEqualityComparer<TKey> | comparer |
LinkedHashMap(Int32)
Declaration
public LinkedHashMap(int capacity)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | capacity |
LinkedHashMap(Int32, IEqualityComparer<TKey>)
Declaration
public LinkedHashMap(int capacity, IEqualityComparer<TKey> comparer)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | capacity | |
System.Collections.Generic.IEqualityComparer<TKey> | comparer |
Properties
| Improve this Doc View SourceCount
Declaration
public override int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Overrides
Lucene.Net.Support.HashMap<TKey, TValue>.Count
|
Improve this Doc
View Source
IsReadOnly
Declaration
public override bool IsReadOnly { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
Lucene.Net.Support.HashMap<TKey, TValue>.IsReadOnly
|
Improve this Doc
View Source
Item[TKey]
Declaration
public override TValue this[TKey key] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
TKey | key |
Property Value
Type | Description |
---|---|
TValue |
Overrides
Lucene.Net.Support.HashMap<TKey, TValue>.Item[TKey]
|
Improve this Doc
View Source
Keys
Declaration
public override ICollection<TKey> Keys { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.ICollection<TKey> |
Overrides
Lucene.Net.Support.HashMap<TKey, TValue>.Keys
|
Improve this Doc
View Source
Values
Declaration
public override ICollection<TValue> Values { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.ICollection<TValue> |
Overrides
Lucene.Net.Support.HashMap<TKey, TValue>.Values
Methods
| Improve this Doc View SourceAdd(TKey, TValue)
Declaration
public override void Add(TKey key, TValue value)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | |
TValue | value |
Overrides
Lucene.Net.Support.HashMap<TKey, TValue>.Add(TKey, TValue)
|
Improve this Doc
View Source
Add(KeyValuePair<TKey, TValue>)
Declaration
public override void Add(KeyValuePair<TKey, TValue> item)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.KeyValuePair<TKey, TValue> | item |
Overrides
Lucene.Net.Support.HashMap<TKey, TValue>.Add(System.Collections.Generic.KeyValuePair<TKey, TValue>)
|
Improve this Doc
View Source
Clear()
Declaration
public override void Clear()
Overrides
Lucene.Net.Support.HashMap<TKey, TValue>.Clear()
|
Improve this Doc
View Source
Contains(KeyValuePair<TKey, TValue>)
Declaration
public override bool Contains(KeyValuePair<TKey, TValue> item)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.KeyValuePair<TKey, TValue> | item |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
Lucene.Net.Support.HashMap<TKey, TValue>.Contains(System.Collections.Generic.KeyValuePair<TKey, TValue>)
|
Improve this Doc
View Source
ContainsKey(TKey)
Declaration
public override bool ContainsKey(TKey key)
Parameters
Type | Name | Description |
---|---|---|
TKey | key |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
Lucene.Net.Support.HashMap<TKey, TValue>.ContainsKey(TKey)
|
Improve this Doc
View Source
CopyTo(KeyValuePair<TKey, TValue>[], Int32)
Declaration
public override void CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.KeyValuePair<TKey, TValue>[] | array | |
System.Int32 | arrayIndex |
Overrides
Lucene.Net.Support.HashMap<TKey, TValue>.CopyTo(System.Collections.Generic.KeyValuePair<TKey, TValue>[], System.Int32)
|
Improve this Doc
View Source
GetEnumerator()
Declaration
public override IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<TKey, TValue>> |
Overrides
Lucene.Net.Support.HashMap<TKey, TValue>.GetEnumerator()
|
Improve this Doc
View Source
Remove(TKey)
Declaration
public override bool Remove(TKey key)
Parameters
Type | Name | Description |
---|---|---|
TKey | key |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
Lucene.Net.Support.HashMap<TKey, TValue>.Remove(TKey)
|
Improve this Doc
View Source
Remove(KeyValuePair<TKey, TValue>)
Declaration
public override bool Remove(KeyValuePair<TKey, TValue> item)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.KeyValuePair<TKey, TValue> | item |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
Lucene.Net.Support.HashMap<TKey, TValue>.Remove(System.Collections.Generic.KeyValuePair<TKey, TValue>)
|
Improve this Doc
View Source
TryGetValue(TKey, out TValue)
Declaration
public override bool TryGetValue(TKey key, out TValue value)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | |
TValue | value |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
Lucene.Net.Support.HashMap<TKey, TValue>.TryGetValue(TKey, TValue)
Implements
System.Collections.Generic.IDictionary<TKey, TValue>
System.Collections.Generic.ICollection<T>
System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable