Stream stream + immutable collection

Immutable collection Create an immutable collection: data cannot be modified and defensively copied to the immutable collection; safe when called by an untrusted library. There are static methods of in the List Set Map interface->Get an immutable collection–>Cannot add, delete, modify (read-only) List<String> list = List.of(“”,””,””); //remove add set xxx is not allowed Set<String> set […]

2023/10/30–C#–Immutable strings, string API, use of StringBuilder class, formatted strings, template strings…

1. Create and add arrays Array intArray = Array.CreateInstance(typeof(int), 5); for (int i = 0; i < intArray.Length; i + + ) { intArray.SetValue(i + 1, i); } Judge the elements in the array based on IndexOf: If there is this element, the index position of the element is displayed; if there is no such […]

Mutable objects/immutable objects, stack/heap management, deep and shallow copies in python

Variable objects/immutable objects, stack/heap management in python The stack in memory and the data structure stack are not the same concept. It can be said that the stack in memory is a real physical area, and the stack in data structure is an abstract data storage structure. The memory space is logically divided into three […]

2023/10/26–C#–Null, double question mark? ? , immutable array, multidimensional array, traversal array

1.Null // Features: //1. Indicates a null reference that does not refer to any object, no memory space is created, and a null reference pointer is stored; //2.Null type is System.Nullable the type of this struct //3. For value types, the assignment cannot be directly null, but the reference type can //4.Default value of null […]

Why is String immutable?

What is an immutable object? In object-oriented and functional programming languages, an immutable object (English: Immutable object) is an object whose state cannot be changed after it is created. Objects whose state can be changed are called mutable objects. –From Baidu Encyclopedia Java8 String source code public final class String implements java.io.Serializable, Comparable<String>, CharSequence {<!– […]

C#11 – Immutable objects and defensive copies

Table of Contents 2. Immutable objects and defensive copies 2.1. Example 2.2. Decompile the example into IL 3. Conclusion 4. References 1. Prerequisite This article is a continuation of my other article: C#11 – Immutable Object Pattern 2. Immutable objects and defensive copies When passing a struct object to a method with the in parameter […]

Solved Rust Error: cannot borrow `x` as mutable more than once at a time

Blogger Maotouhu () takes you to Go to New World? Blog homepage: Maotouhu’s blog “Complete Column of Interview Questions” Articles with pictures and texts Vivid images Simple and easy to learn! Everyone is welcome to step in~ “IDEA Development Cheats Column” Learn the common operations of IDEA and double your work efficiency~ “Master Golang in […]

Using Immutable.js in React

Several data types of Immutable Using Immutable.js in React Example Extend Lodash Lodash common api classification Introduction to APIs commonly used in Lodash: What is the difference between the API in Lodash and the API in JavaScript? How to use Lodash in react Several data types of Immutable List: Ordered index set, similar to Array […]

ArrayList, LinkedList, Collections.singletonList, Arrays.asList and ImmutableList.of

Article directory List ArrayList LinkedList The difference between ArrayList and LinkedList Quickly build a list collection Collections.singletonList Arrays.asList ImmutableList.of There are three types of Java collection types: set (set), list (list) and map (map), and the List collection is a very commonly used collection type. List Our common usage: List<Object> arrays = new ArrayList<>(); First […]