PlusCollections 1.1.0
dotnet add package PlusCollections --version 1.1.0
NuGet\Install-Package PlusCollections -Version 1.1.0
<PackageReference Include="PlusCollections" Version="1.1.0" />
paket add PlusCollections --version 1.1.0
#r "nuget: PlusCollections, 1.1.0"
// Install PlusCollections as a Cake Addin #addin nuget:?package=PlusCollections&version=1.1.0 // Install PlusCollections as a Cake Tool #tool nuget:?package=PlusCollections&version=1.1.0
+Collections
+Collections is a set of extra data structures and functions to support edge cases that are not well covered by the standard collections.
<ins>Table - Order-preserving bidirectional multi-key map</ins>
Table is an implementation of a multiple-key bidirectional map.
Unlike Dictionary
and other traditional key-value maps, Table links two or more keys together.
Groups of related keys are inserted as a "row" that can accessed by any key.
Insertion order is preserved and respected for all key columns.
Overloaded, generic implementations exist for 2, 3, 4, 5, and 6 key tables.
More keys can be trivially added, but single-key tables are not supported (just use an ordered set).
Performance
- Table operates in constant time (except for iteration), but constant overhead scales linearly based on the number of keys per row.
For example,
Table<Key1, Key2>.Add()
will require a bit more than twice as much time asDictionary<Key, Value>.Add()
.Table<Key1, Key2, Key3>.Add()
will take three times as long, and so on. - Insert / Delete complexity -
O(K)
whereK
is the number of keys supported by the implementation. - Update complexity -
O(K^2)
whereK
is the number of keys supported by the implementation. In cases where only one key is changed, complexity returns toO(K)
. - Lookup complexity -
O(1)
(equal toDictionary[key]
) - Iteration complexity -
O(n)
(equal to walking a linked list)
Implementations
Namespace | Class | Description |
---|---|---|
PlusCollections.Table |
Table<TKey1, TKey2> |
Two-key implementation |
PlusCollections.Table |
Table<TKey1, TKey2, TKey3> |
Three-key implementation |
PlusCollections.Table |
Table<TKey1, TKey2, TKey3, TKey4> |
Four-key implementation |
PlusCollections.Table |
Table<TKey1, TKey2, TKey3, TKey4, TKey5> |
Five-key implementation |
PlusCollections.Table |
Table<TKey1, TKey2, TKey3, TKey4, TKey5, TKey6> |
Six-key implementation |
<ins>MaxOrDefault - Max()
with support for empty collections</ins>
EnumerableExtensions implements a new version of IEnumerable<T>.Max
that does not throw if the collection is empty.
Instead, it returns the element type's default value or a user-provided placeholder.
Overloads:
EnumerableExtensions.MaxOrDefault<TIn, TOut>(enumerable, def, callback)
- If the stream is empty, then returnsdef
. Otherwise, passescallback
to the standard implementation ofIEnumerable.Max
and returns the result.EnumerableExtensions.MaxOrDefault<T>(enumerable, def)
- If the stream is empty, then returnsdef
. Otherwise calls the default implementation ofIEnumerable.Max
.EnumerableExtensions.MaxOrDefault<TIn, TOut>(enumerable, callback)
- If the steam is empty, then returnsdefault(TOut)
. Otherwise passescallback
toIEnumerable.Max
.EnumerableExtensions.MaxOrDefault<T>(enumerable)
- If the stream is empty, the returnsdefault(T)
. Otherwise calls the default implementation ofIEnumerable.Max
.
<ins>ListExtensions - Additional variations of Contains()
ListExtensions implements new variations of IList<T>.Contains
that assert not only inclusion, but also position within the list.
Four methods are available:
ListExtensions.ContainsFirst(list, target)
- returns true only iftarget
is the first item inlist
.ListExtensions.ContainsLast(list, target)
- returns true only iftarget
is the last item inlist
.ListExtensions.ContainsNotFirst(list, target)
- return true only iftarget
is inlist
but is not the first item.ListExtensions.ContainsNotLast(list, target)
- returns true only iftarget
is inlist
but is not the last item.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Implement direct key-to-key lookups