Wooly905.DataStructures.RecentItemQueue 1.0.1

dotnet add package Wooly905.DataStructures.RecentItemQueue --version 1.0.1                
NuGet\Install-Package Wooly905.DataStructures.RecentItemQueue -Version 1.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Wooly905.DataStructures.RecentItemQueue" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Wooly905.DataStructures.RecentItemQueue --version 1.0.1                
#r "nuget: Wooly905.DataStructures.RecentItemQueue, 1.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Wooly905.DataStructures.RecentItemQueue as a Cake Addin
#addin nuget:?package=Wooly905.DataStructures.RecentItemQueue&version=1.0.1

// Install Wooly905.DataStructures.RecentItemQueue as a Cake Tool
#tool nuget:?package=Wooly905.DataStructures.RecentItemQueue&version=1.0.1                

Recent Item Queue

This data structure is not like queue. It is more closer to stack. It is a data structure which has stack-like behavior and most-recent-hit on top behavior. Let's see the following examples to understand the details.

Examples

Example 1 - Stack-like behavior under size limit

// Initialize the data strcuture with size of 5
RecentItemQueue<int> queue = new(5);
// insert 3 integers
queue.SetItem(1);
queue.SetItem(2);
queue.SetItem(3);
// retrieve the elements
IReadOnlyList<int> results = queue.GetItems();

// The count of results is 3
// The first element of results is 3
// The second element of results is 2
// The thrid element of results is 1

Example 2 - Stack-like behavior over size limit

// Initialize the data strcuture with size of 4
RecentItemQueue<int> queue = new(4);
// insert 5 integers
queue.SetItem(1);
queue.SetItem(2);
queue.SetItem(3);
queue.SetItem(4);
queue.SetItem(5);
// retrieve the elements
IReadOnlyList<int> results = queue.GetItems();

// The count of results is 4
// The first element of results is 5
// The second element of results is 4
// The thrid element of results is 3
// The fourth element of results is 2
// Integer 1 is gone because the size of the data structure is 4.

Example 3 - Most-recent-hit on top behavior

// Initialize the data strcuture with size of 10
RecentItemQueue<int> queue = new(10);
// insert 4 integers
queue.SetItem(1);
queue.SetItem(2);
queue.SetItem(3);
queue.SetItem(1);
// retrieve the elements
IReadOnlyList<int> results = queue.GetItems();

// The count of results is 3 because integer 1 was hit (no duplicate counting)
// The first element of results is 1 (it's on the top because of hit)
// The second element of results is 3
// The thrid element of results is 2
// Integer 1 was hit (which means it had existed in the data structure) so it poped to the top.

You can see more examples in unit test file.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .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.

Version Downloads Last updated
1.0.1 243 5/16/2023