Questions tagged [apache-commons-lang3]

Apache Commons Lang3 provides a number of helper classes for things that are deemed missing in the Java base libraries. This includes string handling, mathematics helpers, reflection helpers, concurrency and others. Version 3 is a backwards incompatible version update of the original Apache Commons Lang library.

Apache Commons Lang 3 is the latest version of the library.

Note that Lang 3.0 (and subsequent versions) use a different Java package (org.apache.commons.lang3) than the previous versions (org.apache.commons.lang), allowing it to be used at the same time as an earlier version.

Official Website: http://commons.apache.org/lang/

Useful Links:

Related Tags:

80 questions
106
votes
5 answers

Why does Apache Commons consider '१२३' numeric?

According to Apache Commons Lang's documentation for StringUtils.isNumeric(), the String '१२३' is numeric. Since I believed this might be a mistake in the documentation, I ran tests to verify the statement. I found that according to Apache Commons…
Hannes
  • 5,002
  • 8
  • 31
  • 60
66
votes
4 answers

Why was org.apache.common.lang3 StringEscapeUtils deprecated?

I couldn't find any explanation why StringEscapeUtils was deprecated from Apache Lang3 v3.7. https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringEscapeUtils.html What are we supposed to use now for HTML…
gene b.
  • 10,512
  • 21
  • 115
  • 227
29
votes
3 answers

Alternative to using StringEscapeUtils.escapeJavaScript() in commons lang3

I've been tasked with updating our code from using org.apache.commons.lang to org.apache.commons.lang3 and I've found that the newer version of StringEscapeUtils no longer has the method escapeJavaScript() however we were using this in quite a few…
Popeye
  • 11,839
  • 9
  • 58
  • 91
18
votes
2 answers

How to use apache commons BooleanUtils.and method?

Apache commons-lang has two overloaded BooleanUtils.and methods. public static boolean and(final boolean... array) { public static Boolean and(final Boolean... array) { When calling BooleanUtils.and method, ambiguous method call error is…
TheKojuEffect
  • 20,103
  • 19
  • 89
  • 125
15
votes
2 answers

What is the difference between Apache Commons Lang3 vs Apache Commons Text?

I am wondering what is the difference between Apache Commons Lang3 (org.apache.commons.lang3) vs Apache Commons Text (org.apache.commons.text)? I saw many similarities between them. For intance, they both have…
fluency03
  • 2,637
  • 7
  • 32
  • 62
11
votes
1 answer

What is the point of Apache Lang3 StopWatch.split()?

I am currently evaluating implementations between Apache StopWatch and Guava's Stopwatch and the split functionality in the former intrigued me, but I am struggling to understand what exactly it does, and what value it has. According to the…
ryanlutgen
  • 2,951
  • 1
  • 21
  • 31
11
votes
3 answers

Ambiguous compilation error with Maven and apache utils

I'm using org.apache.commons.lang3.BooleanUtils in the commons-lang3 (version 3.1). When I try to compile next line of code BooleanUtils.xor(true, true); using maven-compiler-plugin (version 3.3), I'm getting a compilation failure message: [ERROR]…
Deplake
  • 865
  • 2
  • 9
  • 22
8
votes
2 answers

Replace CompareToBuilder with Java 8's Comparator.comparing(...).thenComparing(...)

Before Java 8, we implemented Comparable.compareTo(...) like this: public int compare(Person a, Person b) { return new CompareToBuilder() .append(a.getLastName(), b.getLastName()) .append(a.getFirstName(),…
6
votes
1 answer

How can I throw an exception for an illegal reflective access warning?

How can I throw an exception for an illegal reflective access warning? For example, consider the following code: import org.apache.commons.lang3.builder.*; class Test { public static void main(String[] args) { …
6
votes
0 answers

Apache Commons Lang3 Hashcode, Equals and ToString including Enums

We have few datatypes defined for our service response and request objects in a model. Recently we found a need of implementing ToString, HashCode and Equals on all such types to make use of these over comparison and assertions. Confirming from few…
Naman
  • 27,789
  • 26
  • 218
  • 353
5
votes
1 answer

Apache Commons Lang: Can the "incompatibilities" between 'lang' and 'lang3' cause different runtime results?

My code uses Apache Commons Lang v.2 (commons-lang). If I update my code to use v.3 (commons-lang3) instead, should I worry that my code might start to behave differently (of course except differences due to fixed bugs and to possible new bugs,…
4
votes
1 answer

Intellij cannot resolve symbol 'lang3' apache

I would like to use StringUtils and have downloaded the "apache commons jar" zip file, copied the unzipped jar file into a lib folder in my intellij project, and added it to Libraries and to the classpath (via Project Settings). Then I imported…
KMunro
  • 348
  • 4
  • 14
4
votes
1 answer

Check if a Java version is greater than a certain iteration in Java?

I wish to check if a user's Java version is at least 1.8.0_171. I mean that specific iteration or higher, meaning 1.8.0_151, for instance, would not work. I planned to originally use org.apache.commons.lang3.SystemUtils'…
Gigi Bayte 2
  • 838
  • 1
  • 8
  • 20
4
votes
0 answers

Pair swap bug in commons-lang3 EqualsBuilder?

The following is a part source code of org.apache.commons.lang3.builder.EqualsBuilder. What is the difference between pair and swappedPair ? why not swappedPair = Pair.of(pair.getRight(), pair.getLeft()); static Pair
devin
  • 41
  • 4
3
votes
1 answer

Apache Commons lang: What's difference between SerializationUtils.clone() and BeanUtils.cloneBean(), when to use which

While writing tests I came across a requirement to clone an object. found 2 Utill classes by apache-commons then I tried to find which one should I use, I've tried to find the diff by reading out both API doc but didn't find which should I use…
Rajat
  • 2,467
  • 2
  • 29
  • 38
1
2 3 4 5 6