![]() |
VOOZH | about |
dotnet add package Albatross.Collections --version 8.0.1
NuGet\Install-Package Albatross.Collections -Version 8.0.1
<PackageReference Include="Albatross.Collections" Version="8.0.1" />
<PackageVersion Include="Albatross.Collections" Version="8.0.1" />Directory.Packages.props
<PackageReference Include="Albatross.Collections" />Project file
paket add Albatross.Collections --version 8.0.1
#r "nuget: Albatross.Collections, 8.0.1"
#:package Albatross.Collections@8.0.1
#addin nuget:?package=Albatross.Collections&version=8.0.1Install as a Cake Addin
#tool nuget:?package=Albatross.Collections&version=8.0.1Install as a Cake Tool
A comprehensive .NET library providing extension methods and data structures for enhanced collection operations. This library offers high-performance algorithms for searching, merging, batching, and manipulating collections with a focus on efficiency and ease of use.
RemoveAny: Automatic algorithm selection based on list sizeRemoveAny_FromRear: Optimized rear-removal for better performanceRemoveAny_WithNewList: Memory-efficient removal for large listsTryGetOneAndRemove: Find and remove single itemsInstall-Package Albatross.Collections
dotnet add package Albatross.Collections
<PackageReference Include="Albatross.Collections" Version="7.5.14" />
# Clone the repository
git clone https://github.com/RushuiGuan/collections.git
cd collections
# Restore dependencies
dotnet restore
# Build the project
dotnet build Albatross.Collections/Albatross.Collections.csproj
# Run tests
dotnet test Albatross.Collections.Test/Albatross.Collections.Test.csproj
using Albatross.Collections;
using System;
using System.Collections.Generic;
using System.Linq;
// Batching items
var numbers = Enumerable.Range(1, 10);
foreach (var batch in numbers.Batch(3))
{
Console.WriteLine($"Batch: {string.Join(", ", batch)}");
}
// Output: Batch: 1, 2, 3
// Batch: 4, 5, 6
// Batch: 7, 8, 9
// Batch: 10
// Dictionary operations
var cache = new Dictionary<string, int>();
var value = cache.GetOrAdd("key1", () => ExpensiveCalculation());
// Remove items from list efficiently
var list = new List<int> { 1, 2, 3, 4, 5 };
var removed = list.RemoveAny(x => x % 2 == 0); // Remove even numbers
// list now contains: [1, 3, 5]
// removed contains: [2, 4]
using Albatross.Collections;
// Search in sorted arrays
var sortedNumbers = new int[] { 1, 3, 5, 7, 9, 11 };
// Find first value >= target
var result = sortedNumbers.BinarySearchFirstValueGreaterOrEqual(6, x => x);
Console.WriteLine(result); // Output: 7
// Search with custom key selector
var people = new[]
{
new { Name = "Alice", Age = 25 },
new { Name = "Bob", Age = 30 },
new { Name = "Charlie", Age = 35 }
};
var person = people.BinarySearchFirstLessOrEqual(28, x => x.Age);
Console.WriteLine(person?.Name); // Output: Alice
using Albatross.Collections;
var oldItems = new[] {
new { Id = 1, Name = "Item1" },
new { Id = 2, Name = "Item2" }
};
var newItems = new[] {
new { Id = 2, Name = "Item2Updated" },
new { Id = 3, Name = "Item3" }
};
oldItems.Merge(newItems,
src => src.Id, // Source key selector
dst => dst.Id, // Destination key selector
(src, dst) => { // Handle matches (updates)
Console.WriteLine($"Update: {dst.Name} -> {src.Name}");
},
src => { // Handle new items
Console.WriteLine($"Add: {src.Name}");
},
dst => { // Handle removed items
Console.WriteLine($"Remove: {dst.Name}");
});
collections/
├── Albatross.Collections/ # Main library
│ ├── Extensions.cs # Core collection extensions
│ ├── SearchExtensions.cs # Binary search operations
│ ├── MergeExtensions.cs # Collection merging utilities
│ └── Albatross.Collections.csproj # Project file
├── Albatross.Collections.Test/ # Unit tests
│ ├── TestExtensions.cs # Extension method tests
│ ├── TestSearch.cs # Search algorithm tests
│ ├── TestSortedData.cs # Sorted data structure tests
│ └── Albatross.Collections.Test.csproj
├── Albatross.Collections.Intervals/ # Interval collections (separate package)
├── Benchmark.Collections/ # Performance benchmarking
├── collections.sln # Solution file
└── README.md # This file
The project includes comprehensive test coverage with 142+ unit tests.
dotnet test Albatross.Collections.Test/Albatross.Collections.Test.csproj
dotnet test Albatross.Collections.Test/Albatross.Collections.Test.csproj --verbosity normal
dotnet test --filter "TestExtensions"
The test suite covers:
We welcome contributions! Please follow these simple steps:
git checkout -b feature/your-featuredotnet testgit commit -m "Add feature X"git push origin feature/your-featureThis project is licensed under the MIT License - see the LICENSE file for details.
MIT License
Copyright (c) 2019 Rushui Guan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 4 NuGet packages that depend on Albatross.Collections:
| Package | Downloads |
|---|---|
|
Albatross.CodeGen.CSharp
Package Description |
|
|
Albatross.CodeGen.TypeScript
Package Description |
|
|
Albatross.Messaging
A durable messaging library built on top of ZeroMQ |
|
|
Albatross.CodeGen.Python
Package Description |
This package is not used by any popular GitHub repositories.