Apache Commons Lang

Apache Commons Lang is a widely-used Java library that provides various utility functions for working with basic Java objects, including strings, arrays, numbers, and more.

Maven Dependency

<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-lang3</artifactId>
    <version>3.12.0</version>
</dependency>

Categories

Splitting of various utility methods across different categories.

  • StringUtils Class

import org.apache.commons.lang3.StringUtils;

Methods

abbreviate(String str, int maxWidth)

It is used to abbreviate or shorten a string to a specified length while appending an ellipsis ("...") to indicate that the string has been shortened.

  • ArrayUtils Class

import org.apache.commons.lang3.ArrayUtils
  • NumberUtils Class

import org.apache.commons.lang3.math.NumberUtils;
  • SystemUtils Class

import org.apache.commons.lang3.SystemUtils;
  • RandomStringUtils Class

import org.apache.commons.lang3.RandomStringUtils;
  • DateUtils Class

import org.apache.commons.lang3.time.DateUtils;
  • EqualsBuilder

import org.apache.commons.lang3.builder.EqualsBuilder;
  • HashCodeBuilder Class

import org.apache.commons.lang3.builder.HashCodeBuilder;

Last updated

Was this helpful?