RockHouse.Collections 0.4.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package RockHouse.Collections --version 0.4.0                
NuGet\Install-Package RockHouse.Collections -Version 0.4.0                
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="RockHouse.Collections" Version="0.4.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RockHouse.Collections --version 0.4.0                
#r "nuget: RockHouse.Collections, 0.4.0"                
#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 RockHouse.Collections as a Cake Addin
#addin nuget:?package=RockHouse.Collections&version=0.4.0

// Install RockHouse.Collections as a Cake Tool
#tool nuget:?package=RockHouse.Collections&version=0.4.0                

RockHouse.Collections

RockHouse.Collections is a Collection class package that mimics the Java language API. It also adds several proprietary APIs.

The following is an example of a class.

  • HashMap
  • LinkedHashMap
  • LinkedOrderedDictionary
  • ListOrderedDictionary
  • ListValuedMap/Dictionary
  • LruMap/Dictionary
  • LinkedHashSet
  • LinkedOrderedSet
  • ListOrderedSet

etc

Java language-like

var map = new HashMap<string, string>();

var get1 = map.Get("a"); // get1 is null

var put1 = map.Put("a", 1); // put1 is null
var get2 = map.Get("a"); // get2 is 1

var put2 = map.Put("a", 2); // put2 is 1
var get3 = map.Get("a"); // get3 is 2

Note: There are some incompatibilities with Java. Since null is not allowed in primitive types, the API that returns null substitutes default(V). For example, default(int) is 0.

Compatibility with .NET API

Enumerable

var map = new HashMap<string, int>()
{
    { "a", 1 },
    { "b", 2 },
    { "c", 3 },
};
foreach (var entry in map)
{
    //
}

LINQ

var map = new HashMap<string, int>()
{
    { "a", 1 },
    { "b", 2 },
    { "c", 3 },
};
var result = String.Join(",", map.Where(e => e.Value > 1).Select(e => e.Key));
System.Console.WriteLine(result); // b,c

Json

With System.Text.Json

var map = new HashMap<string, int>()
{
    { "key1", 1 },
    { "key2", 2 }
};
var json = JsonSerializer.Serialize(map);
var restore = JsonSerializer.Deserialize<HashMap<string, int>>(json);

License

This code is under the Apache License, Version 2.0.

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  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 netcoreapp3.1 is compatible. 
.NET Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
0.9.0 127 2/24/2024
0.8.0 185 6/29/2023
0.7.0 151 6/26/2023
0.6.0 154 6/12/2023
0.5.0 157 6/2/2023
0.4.0 148 5/31/2023
0.3.0 147 5/25/2023
0.2.0 148 5/23/2023
0.1.0 142 5/22/2023