Work in the use of a lot of tools, third-party jar has a lot of ready-made tools to meet their own project needs, this time do not need to repeat the wheel, thus saving a lot of time, we can use these time to do other important things, if not meet their own tool class, This is the time to write your own tool class, the following list some of the common tools used in the work.
1. String Tool class
Apache's Commons-lang3 's stringutils:
a, IsBlank (charsequence cs) Check if the string is null, empty, or a space character, returns a Boolean
B, IsEmpty (Charsequence CS) Checks if the string is null, empty, returns a Boolean
C, Isnotblank (Charsequence CS) Checks if the string is not null, empty, or a space character, returns a Boolean
D, Isnotempty (Charsequence CS) Checks if the string is not null, empty, returns a Boolean
e, IsNumeric (charsequence CS) Checks if the string is a number, returns a Boolean
F, Iswhitespace (Charsequence CS) Checks if the string is a space character and returns a Boolean
g, remove (string str, char remove) removes the specified character from the string and returns a string
H, reverse (string str) reverses the string, returning a
string of tools to master this and Java-brought API basically to meet the daily development needs
2. Collection Tool class
Apache's Org.apache.commons.collections's collectionutils:
A, Collectionutils.isempty (null): True
B, Collectionutils.isnotempty (NULL): false
Spring's Org.springframework.util's collectionutils:
A, Collectionutils.isempty (null): True
Collection Tool Class master The above two basically can meet the daily development, there are also some common APIs do not list the
3. Array Tool class
Apache's commons-lang3 arrayUtils:
a, Collectionutils.isempty (NULL): True
4. Set Generic object Creation tool class
Span style= "Background-color:rgb (255, 255, 255); Color:rgb (51, 51, 51); " >google com.google.common.collect lists,maps,sets:
list<long> a=lists.newarraylist ();
Map<long,string> A=lists.newhashmap ();
Set<long> A=sets.newhashset ();
5. Property Copy Tool Class
Apache's Commons-beans beanUtils:
A, copyproperties (Object dest,object org);
However, using the above attribute copy, if the project does not consider efficiency, you can use the method of this class, if the project to consider the performance, it is recommended to write a property copy class, you can refer to the Apache beanutils.
6. JSON Tool class
Alibaba Fastjson Frame:
can use the inside of the API to the JSON string to the object, and the object to JSON string conversion, there are other JSON framework, you can according to the needs of their own projects to understand the use of
Java (ii): tool classes commonly used in work