In the actual development process, we often use asList to convert arrays to Lists. This method is very convenient to use, but the asList method has several flaws: 1. Avoid using basic data type arrays to convert to lists. Use 8 basic type arrays. There is an interesting flaw when converting to a list. Let’s first look at the following program: public static void main(String[] args) { int[] ints = {1,2,3,4,5}; List list&
1. Detailed introduction to Java improvement
## Introduction: There is an interesting flaw when converting arrays to lists using the 8 basic types. Let’s look at the following program first: public static ...
2. Java Improvement Chapter (36) -----Java Collection Details (2): Defects of asList
Introduction: In the actual development process, we often use asList to convert an array into a List. This method uses It is very convenient, but the asList method has several flaws:
3. Java Improvement Chapter (35) -----Java Collection Details (1): Please provide The collection specifies the initial capacity
Introduction: Collections are very widely used in Java programming. Like the sea, it accepts all rivers, and it is like a universal container that holds all things. Moreover, this sea and universal container can be infinitely larger (if conditions permit). When the volume of this sea or container becomes very large, its initial capacity will become very important, because digging and expanding the sea requires a lot of manpower, material and financial resources. In the same way, the initial capacity of Collection is also extremely important. So: For a known scenario, specify an initial capacity for the collection.
4. Java Improvement Chapter (34)-----fail-fast mechanism
Introduction: In the JDK Collection we often see words similar to this:
5. Java Improvement Article (Three three) -----Map summary
##Introduction: LZ introduced HashMap in detail earlier , HashTable, and TreeMap implementation methods are explained from three aspects: data structure, implementation principle, and source code analysis. You should have a clearer understanding of these three classes. Below, LZ makes a simple summary of Map.
6.
Java Improvement Chapter (32)-----List Summary
Introduction: LZ has already fully introduced most of the knowledge about the List interface, such as ArrayList, LinkedList, Vector, and Stack. Through these knowledge points, we can compare the List interface. Deep understanding. Only knowledge summarized through induction is your knowledge. So below, LZ will make a summary of the List interface. Recommended reading:
7.
Java Improvement Article (Sanyi)-----Stack
Introduction: The Stack class in Java represents a last-in-first-out (LIFO) object stack. The stack is a very common data structure that uses a typical first-in-last-out operation. Each stack contains a stack top. Each time the stack is popped, the data on the top of the stack is taken out, as follows: 8. Java Improvement Chapter (Thirty) --- --Iterator
Introduction: Iteration is definitely not unfamiliar to those of us who work in Java. We often use the iteration interface provided by JDK to iterate Java collections. 9. Java Improvement Chapter (29)-----Vector
Introduction: In the Java Improvement Chapter (Two One) - ArrayList, Java Improvement Chapter (Two Two) - LinkedList, the principles and implementation processes of ArrayList and linkedList are explained in detail. For the List interface here It also introduces its implementation class Vector. The Vector class can implement a growable object array. 10. Java Improvement Chapter (28)------TreeSet
Introduction: Just like HashSet is implemented based on HashMap, TreeSet is also implemented based on TreeMap. In "Java Improvement Chapter (27) -----TreeMap", LZ explained the TreeMap implementation mechanism in detail. If you have read this blog post in detail or have a more detailed understanding of TreeMap, then the implementation of TreeSet will be useful to you. It's as simple as drinking water.
The above is the detailed content of Recommended 10 articles about Java improvement. For more information, please follow other related articles on the PHP Chinese website!