Java Self-learning - Number and String Buffer
Common methods of Java StringBuffer
StringBuffer is a variable length string
Example 1: Additional deletion insert reversal
append addition
Delete delete
Insert insert
reverse reversal
package character;
public class TestString {
public static void main(String[] args) {
String str1 = "let there ";
StringBuffer sb = n ...
Posted by Wakab on Tue, 08 Oct 2019 07:31:50 -0700
Java in-depth learning: concurrent queues
Concurrent queue:
In concurrent queues, JDK has two implementations:
Concurrent LinkedQueue: Non-blocking Queue
BlockingQueue: Blocking Queue
Differences between blocking and non-blocking queues:
When a blocking queue is included in a queue operation, if it exceeds the total number of queues, it will wait at this time; when a queue is e ...
Posted by altexis on Mon, 07 Oct 2019 17:17:14 -0700
How HashSet ensures that elements are not duplicated
HashSet ensures that elements are not duplicated?
To be more direct, in fact, the add() method of HashSet calls the put() method of HashMap. We all know that key of Map does not allow duplication, which is actually the true principle that HashSet can ensure that elements are not duplicated.
Take a loo ...
Posted by learningsql on Mon, 07 Oct 2019 06:23:46 -0700
Java Network Programming--ByteBuf in Netty
Because the ByteBuffer provided in JDK can not be dynamically expanded and the API is complex to use, Netty provides ByteBuffer.
The API of Bytebuf is more convenient and can be expanded dynamically. It provides a variety of implementations of Bytebuf and an efficient zero-copy mechanism.
Operation of ByteBuf
ByteBuf has three important attribu ...
Posted by kristinac on Mon, 07 Oct 2019 02:20:46 -0700
Implementation of BASE64 Coding and Decoding for Pictures in Java 8
Basic encoding is a standard BASE64 encoding, which is used to handle conventional requirements: the output content does not add line breaks, and the output is composed of letters plus numbers.
Recently, I made a Web template, in which I want to use Base64 background image. Although there are ready- ...
Posted by nbarone on Thu, 03 Oct 2019 19:16:42 -0700
Docker Mirror and Docker File Making tomcat Mirror
Make tomcat image:
JDK and tomcat images are constructed based on centos 7.2.1511 basic images provided by the government. First, JDK images are constructed, and then tomcat images are constructed based on JDK images.
Building JDK Mirror
Download the Basic Mirror Centos:
docker pull centos
Execu ...
Posted by neon on Wed, 02 Oct 2019 23:19:00 -0700
In-depth analysis of HashMap source code
HashMap features
The bottom layer of HashMap is array + linked list + red-black tree (JDK 1.8)
HashMap is stored in key-value form, where key can be allowed to be null but can only be one, and key does not allow duplication.
HashMap is thread insecure.
The order in which HashMap is stored and traversed may be inconsistent.
When HashMap saves d ...
Posted by owned on Wed, 02 Oct 2019 17:42:36 -0700
Analysis of MyBatis Log Module
Label (Space Separation): Uncategorized
The package where the log function code resides
org.apache.ibatis.logging
Loading order of log module
mybatis does not have its own log module. It uses third-party logs (and jdk has its own logs)
Log loading order slf4J_commonsLoging_Log4J2_Log4J_JdkLog
Related code
Declare the loading order in the stati ...
Posted by TecTao on Wed, 02 Oct 2019 13:50:26 -0700
Hadoop learning-hadoop installation
Stand-alone version configuration
Upload installation package
Upload to / bigdata
decompression
Unzip to / apps directory
tar -zxvf /bigdata/hadoop-2.7.1.tar.gz -C /apps
Configuring environment variables
vi /etc/profile
#In the final increase
export HADOOP_HOME=/apps/hadoop-2.7.1
export PAT ...
Posted by mimilaw123 on Tue, 01 Oct 2019 09:29:04 -0700
Design Patterns--Agent Patterns
1. What is the agency model?
Agent pattern is one of the most common design patterns. When the target class is inconvenient to operate, another class is used instead of the target class to perform the same operation.
Intention: Provide a proxy for other objects to control access to this object.
II. Static Agent and Dynamic Agent Static proxy ...
Posted by thetechgeek on Tue, 24 Sep 2019 20:13:44 -0700