Questions tagged [immutable-collections]

Immutable Collections is a library containing immutable data structures created by Microsoft for .NET.

Immutable Collections is a library containing immutable data structures created by Microsoft for .NET.

Related tags

93 questions
1
vote
1 answer

Most idiomatic way to iterate through and add to set functionally

I'm using Gremlin to iterate through a GraphTraversal object and retrieve the vertices. Here's what I'm working with: def getVertexSet(vIter: GraphTraversal[Vertex, Vertex]): Set[Vertex] = { val s = mutable.HashSet.empty[Vertex] …
franklin
  • 1,800
  • 7
  • 32
  • 59
1
vote
2 answers

How to orchestrate mutable object as immutable across objects

I have a java class something like this class Runner { public Object run(Map input); public String name(); } public class Test { public static void main(String args[]) { Map map = Maps.newHashMap(); …
kane.zorfy
  • 1,000
  • 4
  • 14
  • 27
1
vote
0 answers

What is the Best C# Sortable Serialized List that can be used with DataContract?

As a part of a class, I have some Immutable POCO objects just to act as a Data Transfer Object for a configuration file. [DataMember] public IReadOnlyList Messages { get; } = new List() { new Warning(75, "UserMessage1",…
Ryan Leach
  • 4,262
  • 5
  • 34
  • 71
1
vote
0 answers

Is java read only ByteBuffer a right object to have immutable byte array?

I need to have immutable array of bytes that will be used in multithreaded environment. I came across ByteBuffer class, it's possible to make as read only with .asReadOnlyBuffer method. However I'm wondering is that a right immutable bytes…
erkfel
  • 1,588
  • 2
  • 17
  • 29
1
vote
2 answers

How to replace value in map for a key based on a condition in scala

I have several immutable map records like : val map = Map("number"->7,"name"->"Jane","city"->"New York") I need to identify the "name" key for each record and check its value.If value is "Jane" , I need to replace with "Doe" and update the map…
b1399877
  • 27
  • 2
  • 6
1
vote
2 answers

Immutables and collections in JavaScript

I'm trying to get my head around how to use Immutables in JavaScript/TypeScript without taking all day about it. I'm not quite ready to take the dive into Immutable.js, because it seems to leave you high and dry as far as type safety. So let's take…
Amy Blankenship
  • 6,485
  • 2
  • 22
  • 45
1
vote
1 answer

Redux/ImmutableJS Nested States + Big-o Complexity of Immutable Collections

I'm trying to get my head around Immutability for my first Redux (NGRX/Store) project. Avoiding state mutation has proved extremely painful, and after battling with Object.assign({}) and state mutation errors, I've discovered Immutable.JS. Which…
reach4thelasers
  • 26,181
  • 22
  • 92
  • 123
1
vote
1 answer

Immutable Tree Map for Java?

I am looking for an implementation of an immutable Tree Map in Java, that allows for copy-on-write style modifications with sharing of identical parts. So, in essence exactly what ImmutableJS does for JavaScript, just for Java. If anyone happens to…
Martin Häusler
  • 6,544
  • 8
  • 39
  • 66
1
vote
0 answers

System.Collections.Immutable reference to System.Runtime and FxCop/metrics

On Windows 7 with .NET 4.5.2 installed, I create a new ClassLibrary project targetting .NET 4.5.2. I want to calculate the code metrics for that assembly by launching the metrics.exe that is shipped with FxCop with Visual Studio 2013 located in…
0
votes
1 answer

java.lang.NoSuchMethodError: com.google.common.collect.ImmutableSet.builder()Lcom/google/common/collect/ImmutableSet$Builder

I'm getting this error continuously Failed to execute goal deploy: {"WFLYCTL0062: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-1" => {"WFLYCTL0080: Failed services" =>…
0
votes
0 answers

How do we get immutable version of HashSet, List, and other stuffs

For example, I have hashSet like this Protected ReadOnly Property idsOfExistingOrder As HashSet(Of String) It's ReadOnly However, the ReadOnliness of that variable simple means that outsider cannot change the HashSet. It can still say add element…
user4951
  • 32,206
  • 53
  • 172
  • 282
0
votes
1 answer

implementing immutable stack in python

Have a question about creating new objects using existing objects in python. Example: I want to implement immutable Stack using python. However, catch here is, whenever I am creating new object, it should be created from existing object: in below…
Todd
  • 3
  • 1
0
votes
1 answer

Immutable vs Concurrent Collections

In the thread When immutable collections are preferable then concurrent it is stated that immutable collections may be slower but they save memory. How is it possible if every change of immutable collection results in creating new object? I…
helpME1986
  • 933
  • 3
  • 12
  • 26
0
votes
1 answer

Why do we pass a reference of collection (or any object) when intializing itself? Please check the code below

Please check line 5 of the code below. And also please correct my question if it's wrong. public class Location { private final Map exits; public Location(Map exits) { if(exits != null)…
0
votes
1 answer

Is it possible to use immutable collections in this case?

I have translated a code from python to F# but I wished to use a more idiomatic syntax. I think that there are two big obstacles poor performance (consider that n is very big) not powerful enough abstractions The current (working) code I have is…
user11323942