What is the best way of representing an immutable list in .NET?

I've recently started using F# for "real work" and rediscovered the beauty of immutable data structures such as the discriminated unions and records in F#. I've also found them to be quite...

Using annotation to ensure that value returned by method is not discarded

String in Java is immutable. The following snippet is, broadly speaking, "wrong". String s = "hello world!"; s.toUpperCase(); // "wrong"!! System.out.println(s); // still "hello...

Clone or make a MailMessage Immutable in .NET / C#

I'm writing a small library where I'm writing some interfaces that takes a MailMessage object and returns a class back to me with a single send method that abstracts away how that MailMessage will...

java string-manipulations

Ok, so I tried with your help to learn a little bit more about strings and Chaining Strings in Java. now I know that strings are immutable, but I'm having a really hard time to do this...

Which is threadsafe atomic or non atomic?

I searched and found immutable are thread safe while mutable is not. This is fine. But i got misleading notes, blogs, answers about atomic vs non-atomic about thread safety, kindly give an...

How can I force a struct's field to always be immutable in Rust?

In Rust, you don't specify mutability inside a struct, but it is inherited from the variable binding. That's great, but is it possible to force a field to be always immutable, even when the root...

Can ES6 template literals be substituted at runtime (or reused)?

tl;dr: Is it possible to make a reusable template literal? I've been trying to use template literals but I guess I just don't get it and now I'm getting frustrated. I mean, I think I get it, but...

Custom init of UIViewController from storyboard

I tried finding some relevant questions but couldn't get anything, hope someone can help. I set up some UIViewController's on a storyboard. I then want to load one of the view controllers in code...

Update Python global time variable using time.time() doesn't work

The variable created by time.time() shouldn't be immutable, right? Therefore, I should be able to change it to something else. I'm having trouble doing this, and it doesn't seem like the .sleep()...

What is RDD in spark

Definition says: RDD is immutable distributed collection of objects I don't quite understand what does it mean. Is it like data (partitioned objects) stored on hard disk If so then how come...

Differentiating between const references to immutable vs. mutable objects

Is there any accepted way in C++ to differentiate between const references to immutable objects vs. mutable ones? e.g. class DataBuffer { // ... }; class Params { // ... }; class C...

`regeneratorRuntime` is not defined when running Jest test

The title pretty much explains what I'm facing. I'm trying to test a React component that has some state, and I attempt to provide my store to the component in order to get what it needs. When I...

Why (and How Can I FIx) ESLint import/no-extraneous-dependencies Failures on Installed Packages?

When I run ESLint I get the following errors: 1:13 error 'joi' should be listed in the project's dependencies. Run 'npm i -S joi' to add it import/no-extraneous-dependencies 2:16 error ...

ecdsa signature verification

next problem: message is signed in python application and will be verified in erlang with public key python can sign message in two ways: with muttable length of signature - erlang verifies...

Java: check CSV file on duplicate lines using ArrayList

I have a CSV file with this content: 2017-10-29 00:00:00.0,"1005",-10227,0,0,0,332894,0,0,222,332894,222,332894 2017-10-29 00:00:00.0,"1010",-125529,0,0,0,420743,0,0,256,420743,256,420743...

redux-immutable mapStateToProps props empty

I'm updating my first react/redux app to use redux-immutable and can't figure out why the props in mapStateToProps are empty. I see the properties populated in the thunk logger output but they are...

How to iterate through a spark dataset and update a column value in Java?

I'm working on POC where I have to update the account number in DB with tokens. I read the data into a dataset dsRecords(about 2M records). I have another routine that had captured distinct...

How to maintain List of mutable objects inside immutable class

I have Immutable class and which has list of Mutable class objects. class Immutable { final int id; final String name; final List<Mutable> list; Immutable(int id,String name,List<Mutable>...

This class inherits from a class marked as @immutable, and therefore should be immutable (all instance fields must be final)

Getting the below issue, and not able to solve it, Can anyone help me in solving this. This class inherits from a class marked as @immutable, and therefore should be immutable (all instance...

React beautiful DnD drag out of position problem

I created a draggable drag and drop table with draggable rows. I'm using react beautiful-dnd for this. When I drag a row, the row gets out of position instead on the position of my cursor. When I...

Dataclass-style object with mutable and immutable properties?

I have been playing around with dataclasses dynamically loaded with property names from a file and I am unable to find a way to create both 'frozen' and 'non-frozen' properties. I believe...

Generate unique ID in a mutable pyspark data frame

I want to generate sequential unique id to a data frame that is subject to change. When i say change it means that more number of rows will be added tomorrow after i generate the ids today. when...

Type androidx.appcompat.resources.R$dimen is defined multiple times

We have a React Native app where after upgrading to Android Studio 3.6.1 and Gradle plugin 3.6.1 we are seeing this compilation error: Type androidx.appcompat.resources.R$dimen is defined multiple...

How to setup jest with node_modules that use es6

I have a very simple test: describe('sanity', () => { it('sanity', () => { expect(true).toBeTruthy() }) }) And I'm receiving the following error: FAIL spec/javascript/sanity_test.js ...

react-native-webview how to inject javascript?

On Android, I had been using expo-stripe-checkout for payments on an Expo managed app. Everything was working fine until I updated to the newest version of expo and react-native. Now, none of the...

Java records with nullable components

I really like the addition of records in Java 14, at least as a preview feature, as it helps to reduce my need to use lombok for simple, immutable "data holders". But I'm having an issue with the...

Event sourcing with GCP BigQuery

We are building a system that stores purchase history of customers. Mainly 3 entities, Orders (mutable data as order status keep changing) Returns (again mutable as return can undergo status...

Unable to add an environment variable to aws elasticbeanstalk environment using terraform

I am trying to add an additional environment variable to my elastic beanstalk environment using terraform and it is erroring out. My tf file looks like below: resource...

How to use @ConfigurationProperties with Records?

Java 16 introduced Records, which help to reduce boilerplate code when writing classes that carry immutable data. When I try to use a Record as @ConfigurationProperties bean as follows I get the...

Flutter const with const constructors

Up until today I haven't seen this dart code suggestions. I am happy to follow best practise, but to be honest, this makes no sense showing up in a stateful widget with no constructor. I thought...