In Java, a utility class was a class that defines a set of methods that perform common functions. This post shows the most frequently used Java utility classes and their most commonly used methods. Both the class list and their method list is ordered by popularity. The data is based in randomly selected 50,000 open source Java projects from GitHub.
Hopefully, you can get a basic idea of what is already provided and popular by browsing the list so it you know you don ' t need to program it by yourself. The names of the methods normally indicate their functions. Also click on the methods to see how they is used in open source projects.
1. Org.apache.commons.io.IOUtils
- Closequietly ()
- ToString ()
- Copy ()
- Tobytearray ()
- Write ()
- Toinputstream ()
- ReadLines ()
- Copylarge ()
- Lineiterator ()
- Readfully ()
2. Org.apache.commons.io.FileUtils
- DeleteDirectory ()
- Readfiletostring ()
- Deletequietly ()
- CopyFile ()
- Writestringtofile ()
- Forcemkdir ()
- Write ()
- Listfiles ()
- CopyDirectory ()
- Forcedelete ()
3. Org.apache.commons.lang.StringUtils
- IsBlank ()
- Isnotblank ()
- IsEmpty ()
- Isnotempty ()
- Equals ()
- Join ()
- Split ()
- EMPTY
- Trimtonull ()
- Replace ()
4. Org.apache.http.util.EntityUtils
- ToString ()
- Consume ()
- Tobytearray ()
- Consumequietly ()
- Getcontentcharset ()
5. Org.apache.commons.lang3.StringUtils
- IsBlank ()
- Isnotblank ()
- IsEmpty ()
- Isnotempty ()
- Join ()
- Equals ()
- Split ()
- EMPTY
- Replace ()
- Capitalize ()
6. Org.apache.commons.io.FilenameUtils
- GetExtension ()
- Getbasename ()
- GetName ()
- Concat ()
- Removeextension ()
- Normalize ()
- Wildcardmatch ()
- Separatorstounix ()
- GetFullPath ()
- Isextension ()
7. Org.springframework.util.StringUtils
- HasText ()
- Haslength ()
- IsEmpty ()
- Commadelimitedlisttostringarray ()
- Collectiontodelimitedstring ()
- Replace ()
- Delimitedlisttostringarray ()
- Uncapitalize ()
- Collectiontocommadelimitedstring ()
- Tokenizetostringarray ()
8. Org.apache.commons.lang.ArrayUtils
- Contains ()
- AddAll ()
- Clone ()
- IsEmpty ()
- Add ()
- Empty_byte_array
- Subarray ()
- IndexOf ()
- Isequals ()
- Toobject ()
9. Org.apache.commons.lang.StringEscapeUtils
- Escapehtml ()
- Unescapehtml ()
- EscapeXML ()
- Escapesql ()
- Unescapejava ()
- Escapejava ()
- Escapejavascript ()
- Unescapexml ()
- Unescapejavascript ()
Ten. Org.apache.http.client.utils.URLEncodedUtils
Org.apache.commons.codec.digest.DigestUtils.
- Md5hex ()
- Shahex ()
- Sha256hex ()
- Sha1hex ()
- SHA ()
- MD5 ()
- Sha512hex ()
- SHA1 ()
Org.apache.commons.collections.CollectionUtils.
- IsEmpty ()
- Isnotempty ()
- Select ()
- Transform ()
- Filter ()
- Find ()
- Collect ()
- Foralldo ()
- AddAll ()
- Isequalcollection ()
Org.apache.commons.lang3.ArrayUtils.
- Contains ()
- IsEmpty ()
- Isnotempty ()
- Add ()
- Clone ()
- AddAll ()
- Subarray ()
- IndexOf ()
- Empty_object_array
- Empty_string_array
Org.apache.commons.beanutils.PropertyUtils.
- GetProperty ()
- SetProperty ()
- Getpropertydescriptors ()
- IsReadable ()
- Copyproperties ()
- Getpropertydescriptor ()
- Getsimpleproperty ()
- IsWriteable ()
- Setsimpleproperty ()
- Getpropertytype ()
Org.apache.commons.lang3.StringEscapeUtils.
- UNESCAPEHTML4 ()
- ESCAPEHTML4 ()
- EscapeXML ()
- Unescapexml ()
- Escapejava ()
- Escapeecmascript ()
- Unescapejava ()
- Escapejson ()
- ESCAPEXML10 ()
Org.apache.commons.beanutils.BeanUtils.
- Copyproperties ()
- GetProperty ()
- SetProperty ()
- Describe ()
- Populate ()
- Copyproperty ()
- Clonebean ()
* The utility classes from Android is excluded since they is designed for Android apps. If you want to see more details, you can search for "utils" in the search Portal:http://www.programcreek.com/java-api-example s/index.php. If the name of a utility class does not contain "Utils", the class was not selected.
Also Org.apache.commons.lang is the old version of import Org.apache.commons.lang3.
Top Java Utility Classes