Understanding String, StringBuffer, StringBuilder Differences and Source Code Implementation

Difference 1. String is a constant, StringBuilder, StringBuffer is a variable. 2. The methods and functions in StringBuffer and StringBuilder are completely equivalent. 3. Only the methods in StringBuffer mostly adopt synchronized keywords to modify, so they are thread-safe. StringBuilder, without this modification, can be consi ...

Posted by nati on Mon, 06 May 2019 00:15:39 -0700

Overview of new features - enumerations, annotations, Lambda expressions, method references

1. Enumeration (actually multiple cases) Enumerations in java are defined using enum, which is not a new structure. Enumerations are defined using enum The Enum enumeration class is actually inherited by default.So the enum structure defined by enum is actually a multiple-instance class. Three commonly used methods for 1.1Enum e ...

Posted by frankstr on Sun, 05 May 2019 10:40:37 -0700

Talking about the Understanding and Implementation of AOP

In a previous discussion with a bull, I found that my knowledge of AOP was not thorough enough, so in the recent period of study, I combed the AOP related knowledge again. What is AOP AOP refers to facet-oriented programming, which mainly extracts some common functions required by business logic from the business implementatio ...

Posted by BlackenedSky on Thu, 02 May 2019 01:40:38 -0700

Design Mode Learning Notebook Handbook

Article directory Classification of GoF Design Patterns 1.1 Creative 1.2 Structural Type 1.3 Behavioral Type II. Overview of Design Principles 2.1 Summary of Object-Oriented Design Principles: 2.2 Single Responsibility Principle 2.3 Open-Close Principle 2.4 Richter Substitution Principle 2.5 Dependence on reversal principl ...

Posted by phpnewbie911 on Wed, 01 May 2019 22:50:37 -0700

Java Foundation: Day_12 String Class, Date Class

I. String class 1. Classification of strings: Immutable String: When an object is created, its content cannot be changed. Once the content changes, it is a new object. Variable String Builder/String Buffer: When the object is created, the content of the object can be changed, and when the content changes, the object remains unch ...

Posted by kusal on Fri, 26 Apr 2019 21:30:50 -0700

Java thread pool "eaten" thread exception (with source code analysis and solution)

Preface Today, I encountered a bug. The phenomenon is that a task is put into the thread pool, which seems to be "not executed" and the log is not typed. After debugging the local code, it was found that NPE was thrown in the first half of the task logic, but there was no try-catch in the outer part of the code, which led to the excep ...

Posted by fresch on Wed, 24 Apr 2019 09:30:35 -0700

Comparison of HashMap Source Codes in JDK 1.7 and JDK 1.8

(1) Comparisons when performing put (K key,V value) operations: The source code in JDK 1.7 is as follows public V put(K key, V value) { if (table == EMPTY_TABLE) { inflateTable(threshold); } if (key == null) //If the key is null, the put for NullKey (Value) operation is performe ...

Posted by tkreinbring on Mon, 22 Apr 2019 16:21:34 -0700

Detailed parsing of BigDecimal

Preface float and double are designed for scientific calculation and engineering calculation. They provide fast and accurate calculations over a wide range of numerical values. However, they do not provide completely accurate results, so they can not be used in situations requiring accurate results. But commercial calculations requ ...

Posted by sunil.23413 on Mon, 22 Apr 2019 16:06:34 -0700

Read headFirst Design Patterns - Decorator Patterns

Inheritance can extend the function of the parent class by reusing the parent code, but at the same time it increases the coupling between objects, so inheritance should be used cautiously. So is there a way to extend the functions of parent classes and decouple objects? The answer is yes. That's the decorator model we're going to learn today. ...

Posted by Robban on Sun, 21 Apr 2019 19:03:34 -0700

Understanding and Analysis of Reflection Mechanism in JAVA

BS53 project uses java reflection to get custom controls, then instantiates them and displays them on the page. It realizes that only one configuration file is needed to display the whole page, and supports different configurations in 5 styles. Basically all depends on reflection technology. Now let's take a brief look at reflection technology ...

Posted by danoli on Sun, 21 Apr 2019 18:18:35 -0700