Tag:Wang Wu

  • Source code analysis of Collectors.toMap null pointer exception in Java 8

    Time:2022-8-14

    When you need to convert a List to Map, you can use Java 8Collectors.toMap()method, Map is a collection of key-value pairs composed of key-value.Collectors.toMap()method, if the value is empty, a null pointer exception will be reported. Let's verify it with an example. First define aStudent.javakind package com.magic.npe; public class Student { private String name; private […]

  • Map

    Time:2022-8-5

    1. Map Map is an unordered key-value based data structure. Map in GO language is a reference type and must be initialized with Make before it can be used. 1.1.1 map definition The definition syntax of map in GO language is as follows map[KeyType]ValueType in, KeyType: Indicates the type of key. ValueType: Indicates the type […]

  • Elasticsearch uses series – Net6 docking elasticsearch

    Time:2022-6-24

    Elasticsearch uses series es introduction and environment construction Elasticsearch using series es basic operations of adding, deleting, querying and modifying +ik word segmentation Elasticsearch uses the series – basic query and aggregate query +sql plug-in Elasticsearch uses series – Net6 docking elasticsearch Elasticsearch uses series docker to build elasticsearch clusters Install nuget package first Install […]

  • Java stream technology

    Time:2022-6-23

    Stream technology Common intermediate operation methods for stream streams (stream can still continue to perform other operations after this method is executed) Stream filter Filter the data in the stream Stream limit intercepts the number of specified parameters Stream skip skips the data of the specified number of parameters and returns the stream composed of […]

  • Tips for using list to map (collectors.tomap) in java8

    Time:2022-6-10

    In actual projects, we often use the list to map operation. In the past, we might use the for loop traversal method. for instance: Define the class first: /Simple object Then there is a list: List<User> userList = Lists. newArrayList( The format we want to convert to map is: A-> Zhang San Past practice (cycle): […]

  • Redis learning notes – (1) – bitmap usage 1 – count the login days of all users in one year

    Time:2022-5-26

    1. Bitmap usage 1: count the login days of all users in one year Command list:setbit getbit bitcount Demand 1: the e-commerce website counts the login days of all users in a year. For example, if the user ID is, we want to count the login days of users every year, such as the following […]

  • Mvcc principle and unreal reading of [MySQL] transactions

    Time:2022-5-24

    First of all, we should understand mvcc. Mvcc is called multi version concurrency control, which is actuallySave a snapshot of the data at a certain time node。 We actually hide two columns per row,Create version number, expired (deleted) version number, every time you start a new transaction,The version number will be incremented automatically。   Take […]

  • JavaScript Basics – built in objects (array objects)

    Time:2022-5-13

    Built in object Array object MDN document link:https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array Object creation array // 1. Array letter quantity var array = []; // Create an empty array var numbers = [1, 2, 4]; // // 2. Array constructor var array = new Array(); // Create an empty array var numbers = new Array(2, 2, 5, 8, 9) […]

  • Filter () method in JavaScript

    Time:2022-4-18

    Filter () method in JavaScript 1. Definition and usage Filter () creates a new array. The elements in the new array are checked by checking all the qualified elements in the specified array. Filter () does not execute this function on empty data Filter () does not change the original array 2. Grammar array.filter(function(currentValue, index, […]