The strategic model of behavior model

1 General Strategy pattern is a kind of behavior pattern with low complexity. When there are many ways to complete a task, you can consider using strategy pattern. 2. Strategic mode In the strategy mode, we need to define a family of algorithms and put them into independent classes, each of which represents a method to complete the task. For ex ...

Posted by mezise on Sun, 24 May 2020 11:46:50 +0200

How does Java achieve an elegant stop?Get to the bottom of

Traveling in the Java world, if you can have a pair of eyes that are good at discovery, there are many things to watch carefully, plus patience and help, you will often taste different things carefully. With this sharing, you can easily get the following points, which are absolutely rewarding. a) How do you make Java programs look elegant?Thoug ...

Posted by brandtj on Wed, 20 May 2020 04:01:28 +0200

How to implement the new features of JDK10: var generics and multiple interfaces, case details

Today, let's think about var and generics, multiple interface implementation. Implement multiple interfaces In the implementation of JDK and our daily work, many interfaces need to be implemented. Let's take two common examples, ArrayList and CopyOnWriteArrayList. First look at their definition: public class ArrayList<E> extends Abstrac ...

Posted by noiseusse on Mon, 18 May 2020 04:52:05 +0200

A new feature of JDK 14: switch expression

brief introduction The new feature of switch has a long history. It was introduced as a preview function as early as JDK 12, and finally became an official version of the function in JDK 14: JEP 361: Switch Expressions (Standard). In fact, there are two new functions of switch, one is that case can be linked, the other is that switch can bring ...

Posted by DaRkZeAlOt on Sat, 09 May 2020 01:02:44 +0200

Seven traversal methods and performance analysis of HashMap, a must for high salary

With the release of JDK 1.8 Streams API, HashMap has more ways to traverse, but which one should be chosen? Instead, it becomes a problem. This paper starts with the traversal method of HashMap, and then analyzes the advantages and disadvantages of various traversal methods of HashMap from the aspects of performance, principle and security. Th ...

Posted by 990805 on Mon, 04 May 2020 14:53:42 +0200

ElasticSearch close restart command

ElasticSearch close restart command From: http://www.cnblogs.com/ae6623/p/5110927.html Many people learn elasticSearch by self-study. There is no answer to Baidu's question of how to restart es. I'm trying to figure it out. I hope I can help you. 1. How to close ES and elasticsearch 1. Use the head plug-in Find the node you wan ...

Posted by codered27 on Sun, 03 May 2020 14:54:12 +0200

Generics and annotations in Java

1, Use of enumeration classes 1. Description of enumeration class: Understanding of enumeration class: there are only a limited number of objects in the class, which are certain. We call this class an enumeration class Enumeration classes are strongly recommended when you need to define a set of constants Implementation of enumerat ...

Posted by surajkandukuri on Sun, 26 Apr 2020 07:02:31 +0200

Common Java classes

1, String class Use of java.lang.String class (1) Overview String: string, represented by a pair of "" causes. String declared final, cannot be inherited String implements the Serializable interface: indicates that strings support serialization. Implemented the compatible interface: indicates that string can compare sizes ...

Posted by schajee on Tue, 21 Apr 2020 14:51:29 +0200

JEP interpretation and tasting Series 2 - JEP 142 cache line filling simplification

This article is based on OpenJDK 8 ~ 14 JEP 142 content It is used to fill a cache row with one or some field s that need to be read and modified by multiple threads. At the same time, due to the way of filling cache rows before Java 8, which is cumbersome and not elegant enough, there may be different sizes of cache rows, so the @ contented ...

Posted by lightningstrike on Sat, 18 Apr 2020 10:02:43 +0200

Don't ask me how many objects new string created! I'll prove it to you!

Yunqi information:[ Click to see more industry information]Here you can find the first-hand cloud information of different industries. What are you waiting for? Come on! I think all Java programmers have been bothered by this new String question, which is a high-frequency Java interview question, but unfortunately, there are different opinions ...

Posted by wulfgar on Fri, 17 Apr 2020 09:46:27 +0200