How to improve the speed of writing java programs

王林
Release: 2019-11-16 11:28:07
Original
2286 people have browsed it

How to improve the speed of writing java programs

Generally, if you want to write a program well and complete it within a period of time, you must use ready-made things. In a new function, how to call ready-made things? Just use third-party packages or use your own code base. Next, we introduce some good code libraries.

General library

Apache's centralized packages that are often used, such as the apache commons package and the goole guava package, you need to know at least a few key classes such as StringUtils class, these and others need to remember their usage. At least most of the string processing work can be done in StringUtils.

Time processing class

In the past, JodaTime was mostly used. This library can help solve many time processing problems, but after java8 came out, using java8 new Time processing is also very convenient, but we are generally accustomed to using the Date class. How to efficiently complete event processing? I myself summarized a DateUtil class, which contains time processing methods that I often need to use.

Collection class library

Collection is one of the most frequently used ones. In work, most of them will use ArrayList, HashMap, and HashSet, these three collection classes. This Apache Commons Collections library can handle the parts that many classes need to deal with. I personally recommend that in addition to the three commonly used collection classes, you need to know more about other collection classes and use them in some special occasions, because other Collection classes are designed to be suitable for some special occasions and are more efficient than common classes.

Encryption Library

Commons Codec in the Apache Commons family provides some public codec implementations, but I personally recommend maintaining your own encryption library. Because jdk already provides native encryption algorithms, you need to encapsulate them yourself, and the tool class you maintain is to centralize these algorithms.

Unit testing library

Unit testing is a very neglected one, but it is a very important one. I use JUnit, a testing library that I often use in my work. Mockito and PowerMock, these three testing libraries meet most situations. If you use it skillfully, you can increase the unit test coverage to a certain ratio during the development process. If you run the unit test every time you change the code, then the code you maintain will have few errors.

Recommended tutorial:Java tutorial

The above is the detailed content of How to improve the speed of writing java programs. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!