From Java9, the constructor of the class corresponding to primitive types is deprecated.

For details, see the following issue.

https://bugs.openjdk.java.net/browse/JDK-8176335

By the way, if you look at the Character source code ...

public static Character valueOf(char c) {
    if (c <= 127) { // must cache
        return CharacterCache.cache[(int)c];
    }
    return new Character(c);
}

In this way, the valueOf method has a cache mechanism, and the instance creation cost is low.

Recommended Posts

From Java9, the constructor of the class corresponding to primitive types is deprecated.
[Java beginner] Conversion from character string to numerical value-What is the parseInt method of the Integer class? ~
[Java] Calculate the day of the week from the date (Calendar class is not used)
How to write Scala from the perspective of Java
Generate Stream from an array of primitive types in Java
The road from JavaScript to Java
The milliseconds to set in /lib/calendars.properties of Java jre is UTC
From fledgling Java (3 years) to Node.js (4 years). And the impression of returning to Java
[Java] How to use the File class
[Java] How to use the HashMap class
Studying how to use the constructor (java)
[Processing × Java] How to use the class
Output of the book "Introduction to Java"
[Java] How to use the Calendar class
[Java Servlet] The road of Senri is also the fifth step from the first step
[Java Servlet] The road of Senri is also one step to the first
[Java Servlet] The road of Senri is also the third step from the first step
How to find out the Java version of a compiled class file
[Java] How to get to the front of a specific string using the String class
I translated the grammar of R and Java [Updated from time to time]
[Java Servlet] The road of Senri is also the fourth step from the first step
What is CHECKSTYLE: OFF found in the Java source? Checkstyle to know from
[Promotion of Ruby comprehension (1)] When switching from Java to Ruby, first understand the difference.
How to get Class from Element in Java
Increment with the third argument of iterate method of Stream class added from Java9
[Java] Where is the implementation class of annotation that exists in Bean Validation?
[Java] Is it unnecessary to check "identity" in the implementation of the equals () method?
I tried to make a program that searches for the target class from the process that is overloaded with Java
[Java] How to get the authority of the folder
What is ... (3 dots) found in the Java source? Variadic arguments to know from
First touch of the Files class (or Java 8)
Java Welcome to the Swamp of 2D Arrays
Sample code to get the values of major SQL types in Java + MySQL 8.0
A memo about the types of Java O/R mappers and how to select them
How to get the class name of the argument of LoggerFactory.getLogger when using SLF4J in Java
[Java] How to get the URL of the transition source
[Java] How to use compareTo method of Date class
From the introduction of devise to the creation of the users table
[Java] How to omit the private constructor in Lombok
When the hover of Eclipse is hard to see
[Java] I want to calculate the difference from the date
Volume 3 types of Docker Compose considered from the purpose
[Java] Types of comments and how to write them
The comparison of enums is ==, and equals is good [Java]
[Java] How to extract the file name from the path
The story of migrating from Paperclip to Active Storage
Java language from the perspective of Kotlin and C #
GetXxxx of ResultSet was addicted to primitive type (Java)
I summarized the types and basics of Java exceptions
Java: Use Stream to sort the contents of the collection
Equivalence comparison of Java wrapper classes and primitive types
Summarize the additional elements of the Optional class in Java 9
Changes from Java 8 to Java 11
Sum from Java_1 to 100
From Java to Ruby !!
[VBA] I tried to make a tool to convert the primitive type of Entity class generated by Hibernate Tools to the corresponding reference type.
I want to find out which version of java the jar file I have is available
Sample code to get the values of major SQL types in Java + Oracle Database 12c
The story of raising Spring Boot from 1.5 series to 2.1 series part2
Java to fly data from Android to ROS of Jetson Nano
Is the method of the primitive specialized IntFunction apply or applyAsInt?