SoftUni.Wintellect.PowerCollections 2.0.0

Wintellect Power Collections is a community project to develop the best public license type-safe collection classes for .NET. Power Collections implements classical data structures (lists, sets, bags, dictionaries) in C#, which are well optimized for performance, and makes heavy use of .NET generics. The goal of the project is to provide generic high-performance collection classes that are not available in .NET standard library. Data structures, implemented in PowerCollections:

Set<T>: a collection of items (maintained in unpredictable order). Duplicate items are not allowed.

Bag<T>: a collection of items, which allows duplicates. Similar to Set<T> but allows duplicates.

BigList<T>: a list of items, optimized for efficient operations on large lists (especially for insertions, deletions, copies, and concatenations).

Deque<T>: implementation of Deque (Double Ended Queue), with efficient inserting elements at the beginning and at the end.

MultiDictionary<TKey, TValue>: a dictionary collection, which associates multiple values with a key. Lookup by key returns an enumeration of items.

OrderedSet<T>: a collection of items, maintained in a sorted order (duplicates are not allowed). Each item has an index in the set (0…Count-1). Provides efficient sub-range extraction.

OrderedBag<T>: a collection of items, maintained in a sorted order, with duplicates. Provides efficient sub-range extraction.

OrderedDictionary<TKey, TValue>: a dictionary collection that associates keys to values. The keys are maintained in a sorted order. Provides efficient sub-range extraction.

OrderedMultiDictionary<TKey, TValue>: a dictionary collection that associates multiple values with a key. The keys are maintained in a sorted order. Lookup by key returns an enumeration of items. Provides efficient sub-range extraction.

This library was originally produced by Wintellect and is offered AS IS. It has been available on the Wintellect site for some time, later moved to Codeplex to encourage its growth and use, and then it was lost with the shutdown of Codeplex. Power Collections is free for all to use within the bounds of the standard Eclipse Public License (EPL).

The code is originally written by Peter Golde (at Wintellect, in the period 2004-2007), then evolved in the open-source community.

Install-Package SoftUni.Wintellect.PowerCollections -Version 2.0.0
dotnet add package SoftUni.Wintellect.PowerCollections --version 2.0.0
<PackageReference Include="SoftUni.Wintellect.PowerCollections" Version="2.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SoftUni.Wintellect.PowerCollections --version 2.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SoftUni.Wintellect.PowerCollections, 2.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install SoftUni.Wintellect.PowerCollections as a Cake Addin
#addin nuget:?package=SoftUni.Wintellect.PowerCollections&version=2.0.0

// Install SoftUni.Wintellect.PowerCollections as a Cake Tool
#tool nuget:?package=SoftUni.Wintellect.PowerCollections&version=2.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Getting Started

Install the NuGet package:

Install-Package SoftUni.Wintellect.PowerCollections

Import the namespace in your C# code:

using Wintellect.PowerCollections;

Wintellect.PowerCollections.Bag<T>: Example

Console.WriteLine("Bag<T> example:");
Bag<string> bag = new Bag<string>();
bag.Add("programming");
bag.Add("C#");
bag.Add("Visual Studio");
bag.Add("dotnet");
bag.Add("C#");
bag.Add("C#");
Console.WriteLine("Contains `dotnet`: {0}", bag.Contains("dotnet"));
Console.WriteLine("Deleted the first `C#` occurence: " + bag.Remove("C#"));
Console.WriteLine("Elements: {0}", bag);  

The above code will produce the following output:

Bag<T> example:
Contains `dotnet`: True
Deleted the first `C#` occurence: True
Elements: {dotnet,C#,C#,programming,Visual Studio}

Wintellect.PowerCollections.OrderedBag<T>: Example

Console.WriteLine("OrderedBag<T> example:");
OrderedBag<string> bag = new OrderedBag<string>();
bag.Add("programming");
bag.Add("C#");
bag.Add("Visual Studio");
bag.Add("dotnet");
bag.Add("C#");
bag.Add("C#");
Console.WriteLine("Contains `dotnet`: {0}", bag.Contains("dotnet"));
Console.WriteLine("Deleted the first `C#` occurence: " + bag.Remove("C#"));
Console.WriteLine("Elements: {0}", bag);
Console.WriteLine("Range[`d`...`q`]: {0}", bag.Range("d", true, "q", true));

The above code will produce the following output:

OrderedBag<T> example:
Contains `dotnet`: True
Deleted the first `C#` occurence: True
Elements: {C#,C#,dotnet,programming,Visual Studio}
Range[`d`...`q`]: {dotnet,programming}

Wintellect.PowerCollections.Set<T>: Example

Console.WriteLine("Set<T> example:");
Set<string> set = new Set<string>();
set.Add("programming");
set.Add("C#");
set.Add("Visual Studio");
set.Add("dotnet");
set.Add("C#");
set.Add("C#");
Console.WriteLine("Contains `dotnet`: {0}", set.Contains("dotnet"));
Console.WriteLine("Deleted the first `C#` occurence: " + set.Remove("C#"));

The above code will produce the following output:

Set<T> example:
Contains `dotnet`: True
Deleted the first `C#` occurence: True
Elements: {dotnet,programming,Visual Studio}

Wintellect.PowerCollections.OrderedSet<T>: Example

Console.WriteLine("OrderedSet<T> example:");
OrderedSet<string> set = new OrderedSet<string>();
set.Add("programming");
set.Add("C#");
set.Add("Visual Studio");
set.Add("dotnet");
set.Add("C#");
set.Add("C#");
Console.WriteLine("Contains `dotnet`: {0}", set.Contains("dotnet"));
Console.WriteLine("Deleted the first `C#` occurence: " + set.Remove("C#"));
Console.WriteLine("Elements: {0}", set);
Console.WriteLine("Range[`d`...`q`]: {0}", set.Range("d", true, "q", true));

The above code will produce the following output:

OrderedSet<T> example:
Contains `dotnet`: True
Deleted the first `C#` occurence: True
Elements: {dotnet,programming,Visual Studio}
Range[`d`...`q`]: {dotnet,programming}

Wintellect.PowerCollections.BigList<T>: Example

Console.WriteLine("BigList<T> example:");
BigList<string> list = new BigList<string>();
list.Add("programming");
list.Add("C#");
list.Add("Visual Studio");
list.Add("dotnet");
list.Add("C#");
list.Add("C#");
Console.WriteLine("Elements: {0}", list);
Console.WriteLine("Elements[2]: {0}", list[2]);
list.RemoveAt(2);
Console.WriteLine("Deleted list[2]");
list.Insert(1, "TypeScript");
Console.WriteLine("Added `TypeScript` at position 1");
Console.WriteLine("Elements: {0}", list);

The above code will produce the following output:

BigList<T> example:
Elements: {programming,C#,Visual Studio,dotnet,C#,C#}
Elements[2]: Visual Studio
Deleted list[2]
Added `TypeScript` at position 1
Elements: {programming,TypeScript,C#,dotnet,C#,C#}

Wintellect.PowerCollections.Deque<T>: Example

Console.WriteLine("Deque<T> example:");
Deque<string> list = new Deque<string>();
list.AddToBack("programming");
list.AddToBack("C#");
list.AddToFront("Visual Studio");
list.AddToBack("dotnet");
list.AddToFront("C#");
list.AddToBack("C#");
Console.WriteLine("Elements: {0}", list);
Console.WriteLine("Removed element from front: {0}", list.RemoveFromFront());
Console.WriteLine("Removed element from back: {0}", list.RemoveFromBack());
Console.WriteLine("Elements: {0}", list);

The above code will produce the following output:

Deque<T> example:
Elements: {C#,Visual Studio,programming,C#,dotnet,C#}
Removed element from front: C#
Removed element from back: C#
Elements: {Visual Studio,programming,C#,dotnet}

Wintellect.PowerCollections.MultiDictionary<K, V>: Example

Console.WriteLine("MultiDictionary<K, V> example:");
MultiDictionary<string, int> score = new MultiDictionary<string, int>(true);
score.Add("Peter", 5);
score.Add("Peter", 6);
score.Add("Peter", 6);
score.AddMany("Maria", new int[] { 5, 4, 5, 4, 6 });
score.AddMany("George", new int[] { 6, 6, 5, 5 });
Console.WriteLine("Elements: {0}", score);
Console.WriteLine("Removed element `Maria -> 4`: {0}", score.Remove("Maria", 4));
Console.WriteLine("Elements: {0}", score);

The above code will produce the following output:

MultiDictionary<K, V> example:
Elements: {Maria->(5,4,5,4,6), Peter->(5,6,6), George->(6,6,5,5)}
Removed element `Maria -> 4`: True
Elements: {Maria->(5,4,5,6), Peter->(5,6,6), George->(6,6,5,5)}

Wintellect.PowerCollections.OrderedDictionary<K, V>: Example

Console.WriteLine("OrderedDictionary<K, V> example:");
OrderedDictionary<string, double> ratings = new OrderedDictionary<string, double>();
ratings.Add("Peter", 8.5);
ratings.Add("Maria", 9.7);
ratings.Add("George", 7.6);
ratings.Add("Paula", 9.2);
ratings.Add("Steve", 7.7);
Console.WriteLine("Elements: {0}", ratings);
Console.WriteLine("Range[`k`...`r`]: {0}", ratings.Range("k", true, "r", true));
Console.WriteLine("Removed element `Maria`: {0}", ratings.Remove("Maria"));
Console.WriteLine("Elements: {0}", ratings);

The above code will produce the following output:

OrderedDictionary<K, V> example:
Elements: {George->7.6, Maria->9.7, Paula->9.2, Peter->8.5, Steve->7.7}
Range[`k`...`r`]: {Maria->9.7, Paula->9.2, Peter->8.5}
Removed element `Maria`: True
Elements: {George->7.6, Paula->9.2, Peter->8.5, Steve->7.7}

Wintellect.PowerCollections.OrderedMultiDictionary<K, V>: Example

Console.WriteLine("OrderedMultiDictionary<K, V> example:");
OrderedMultiDictionary<string, int> score = new OrderedMultiDictionary<string, int>(true);
score.Add("Peter", 5);
score.Add("Peter", 6);
score.Add("Peter", 6);
score.AddMany("Maria", new int[] { 5, 5, 4, 6 });
score.AddMany("George", new int[] { 6, 6, 5 });
score.AddMany("Paula", new int[] { 6, 6, 5, 6 });
score.AddMany("Steve", new int[] { 5, 6 });
Console.WriteLine("Elements: {0}", score);
Console.WriteLine("Removed element `Maria -> 4`: {0}", score.Remove("Maria", 4));
Console.WriteLine("Elements: {0}", score);
Console.WriteLine("Range[`k`...`r`]: {0}", score.Range("k", true, "r", true));

The above code will produce the following output:

OrderedMultiDictionary<K, V> example:
Elements: {George->(5,6,6), Maria->(4,5,5,6), Paula->(5,6,6,6), Peter->(5,6,6), Steve->(5,6)}
Removed element `Maria -> 4`: True
Elements: {George->(5,6,6), Maria->(5,5,6), Paula->(5,6,6,6), Peter->(5,6,6), Steve->(5,6)}
Range[`k`...`r`]: {Maria->(5,5,6), Paula->(5,6,6,6), Peter->(5,6,6)}

Getting Started

Install the NuGet package:

Install-Package SoftUni.Wintellect.PowerCollections

Import the namespace in your C# code:

using Wintellect.PowerCollections;

Wintellect.PowerCollections.Bag<T>: Example

Console.WriteLine("Bag<T> example:");
Bag<string> bag = new Bag<string>();
bag.Add("programming");
bag.Add("C#");
bag.Add("Visual Studio");
bag.Add("dotnet");
bag.Add("C#");
bag.Add("C#");
Console.WriteLine("Contains `dotnet`: {0}", bag.Contains("dotnet"));
Console.WriteLine("Deleted the first `C#` occurence: " + bag.Remove("C#"));
Console.WriteLine("Elements: {0}", bag);  

The above code will produce the following output:

Bag<T> example:
Contains `dotnet`: True
Deleted the first `C#` occurence: True
Elements: {dotnet,C#,C#,programming,Visual Studio}

Wintellect.PowerCollections.OrderedBag<T>: Example

Console.WriteLine("OrderedBag<T> example:");
OrderedBag<string> bag = new OrderedBag<string>();
bag.Add("programming");
bag.Add("C#");
bag.Add("Visual Studio");
bag.Add("dotnet");
bag.Add("C#");
bag.Add("C#");
Console.WriteLine("Contains `dotnet`: {0}", bag.Contains("dotnet"));
Console.WriteLine("Deleted the first `C#` occurence: " + bag.Remove("C#"));
Console.WriteLine("Elements: {0}", bag);
Console.WriteLine("Range[`d`...`q`]: {0}", bag.Range("d", true, "q", true));

The above code will produce the following output:

OrderedBag<T> example:
Contains `dotnet`: True
Deleted the first `C#` occurence: True
Elements: {C#,C#,dotnet,programming,Visual Studio}
Range[`d`...`q`]: {dotnet,programming}

Wintellect.PowerCollections.Set<T>: Example

Console.WriteLine("Set<T> example:");
Set<string> set = new Set<string>();
set.Add("programming");
set.Add("C#");
set.Add("Visual Studio");
set.Add("dotnet");
set.Add("C#");
set.Add("C#");
Console.WriteLine("Contains `dotnet`: {0}", set.Contains("dotnet"));
Console.WriteLine("Deleted the first `C#` occurence: " + set.Remove("C#"));

The above code will produce the following output:

Set<T> example:
Contains `dotnet`: True
Deleted the first `C#` occurence: True
Elements: {dotnet,programming,Visual Studio}

Wintellect.PowerCollections.OrderedSet<T>: Example

Console.WriteLine("OrderedSet<T> example:");
OrderedSet<string> set = new OrderedSet<string>();
set.Add("programming");
set.Add("C#");
set.Add("Visual Studio");
set.Add("dotnet");
set.Add("C#");
set.Add("C#");
Console.WriteLine("Contains `dotnet`: {0}", set.Contains("dotnet"));
Console.WriteLine("Deleted the first `C#` occurence: " + set.Remove("C#"));
Console.WriteLine("Elements: {0}", set);
Console.WriteLine("Range[`d`...`q`]: {0}", set.Range("d", true, "q", true));

The above code will produce the following output:

OrderedSet<T> example:
Contains `dotnet`: True
Deleted the first `C#` occurence: True
Elements: {dotnet,programming,Visual Studio}
Range[`d`...`q`]: {dotnet,programming}

Wintellect.PowerCollections.BigList<T>: Example

Console.WriteLine("BigList<T> example:");
BigList<string> list = new BigList<string>();
list.Add("programming");
list.Add("C#");
list.Add("Visual Studio");
list.Add("dotnet");
list.Add("C#");
list.Add("C#");
Console.WriteLine("Elements: {0}", list);
Console.WriteLine("Elements[2]: {0}", list[2]);
list.RemoveAt(2);
Console.WriteLine("Deleted list[2]");
list.Insert(1, "TypeScript");
Console.WriteLine("Added `TypeScript` at position 1");
Console.WriteLine("Elements: {0}", list);

The above code will produce the following output:

BigList<T> example:
Elements: {programming,C#,Visual Studio,dotnet,C#,C#}
Elements[2]: Visual Studio
Deleted list[2]
Added `TypeScript` at position 1
Elements: {programming,TypeScript,C#,dotnet,C#,C#}

Wintellect.PowerCollections.Deque<T>: Example

Console.WriteLine("Deque<T> example:");
Deque<string> list = new Deque<string>();
list.AddToBack("programming");
list.AddToBack("C#");
list.AddToFront("Visual Studio");
list.AddToBack("dotnet");
list.AddToFront("C#");
list.AddToBack("C#");
Console.WriteLine("Elements: {0}", list);
Console.WriteLine("Removed element from front: {0}", list.RemoveFromFront());
Console.WriteLine("Removed element from back: {0}", list.RemoveFromBack());
Console.WriteLine("Elements: {0}", list);

The above code will produce the following output:

Deque<T> example:
Elements: {C#,Visual Studio,programming,C#,dotnet,C#}
Removed element from front: C#
Removed element from back: C#
Elements: {Visual Studio,programming,C#,dotnet}

Wintellect.PowerCollections.MultiDictionary<K, V>: Example

Console.WriteLine("MultiDictionary<K, V> example:");
MultiDictionary<string, int> score = new MultiDictionary<string, int>(true);
score.Add("Peter", 5);
score.Add("Peter", 6);
score.Add("Peter", 6);
score.AddMany("Maria", new int[] { 5, 4, 5, 4, 6 });
score.AddMany("George", new int[] { 6, 6, 5, 5 });
Console.WriteLine("Elements: {0}", score);
Console.WriteLine("Removed element `Maria -> 4`: {0}", score.Remove("Maria", 4));
Console.WriteLine("Elements: {0}", score);

The above code will produce the following output:

MultiDictionary<K, V> example:
Elements: {Maria->(5,4,5,4,6), Peter->(5,6,6), George->(6,6,5,5)}
Removed element `Maria -> 4`: True
Elements: {Maria->(5,4,5,6), Peter->(5,6,6), George->(6,6,5,5)}

Wintellect.PowerCollections.OrderedDictionary<K, V>: Example

Console.WriteLine("OrderedDictionary<K, V> example:");
OrderedDictionary<string, double> ratings = new OrderedDictionary<string, double>();
ratings.Add("Peter", 8.5);
ratings.Add("Maria", 9.7);
ratings.Add("George", 7.6);
ratings.Add("Paula", 9.2);
ratings.Add("Steve", 7.7);
Console.WriteLine("Elements: {0}", ratings);
Console.WriteLine("Range[`k`...`r`]: {0}", ratings.Range("k", true, "r", true));
Console.WriteLine("Removed element `Maria`: {0}", ratings.Remove("Maria"));
Console.WriteLine("Elements: {0}", ratings);

The above code will produce the following output:

OrderedDictionary<K, V> example:
Elements: {George->7.6, Maria->9.7, Paula->9.2, Peter->8.5, Steve->7.7}
Range[`k`...`r`]: {Maria->9.7, Paula->9.2, Peter->8.5}
Removed element `Maria`: True
Elements: {George->7.6, Paula->9.2, Peter->8.5, Steve->7.7}

Wintellect.PowerCollections.OrderedMultiDictionary<K, V>: Example

Console.WriteLine("OrderedMultiDictionary<K, V> example:");
OrderedMultiDictionary<string, int> score = new OrderedMultiDictionary<string, int>(true);
score.Add("Peter", 5);
score.Add("Peter", 6);
score.Add("Peter", 6);
score.AddMany("Maria", new int[] { 5, 5, 4, 6 });
score.AddMany("George", new int[] { 6, 6, 5 });
score.AddMany("Paula", new int[] { 6, 6, 5, 6 });
score.AddMany("Steve", new int[] { 5, 6 });
Console.WriteLine("Elements: {0}", score);
Console.WriteLine("Removed element `Maria -> 4`: {0}", score.Remove("Maria", 4));
Console.WriteLine("Elements: {0}", score);
Console.WriteLine("Range[`k`...`r`]: {0}", score.Range("k", true, "r", true));

The above code will produce the following output:

OrderedMultiDictionary<K, V> example:
Elements: {George->(5,6,6), Maria->(4,5,5,6), Paula->(5,6,6,6), Peter->(5,6,6), Steve->(5,6)}
Removed element `Maria -> 4`: True
Elements: {George->(5,6,6), Maria->(5,5,6), Paula->(5,6,6,6), Peter->(5,6,6), Steve->(5,6)}
Range[`k`...`r`]: {Maria->(5,5,6), Paula->(5,6,6,6), Peter->(5,6,6)}

Release Notes

This release supports the .NET Standard (.NET Core and .NET Framework).

  • .NETFramework 2.0

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on SoftUni.Wintellect.PowerCollections:

Repository Stars
Pscx/Pscx
PowerShell Community Extensions module repository

Version History

Version Downloads Last updated
2.0.0 161 2/28/2021
1.1.5733.22550 5,937 9/12/2015
1.0.5731.26533 1,451 9/10/2015