You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2022/05/15 20:01:05 UTC
[commons-lang] branch master updated: Fix, lambda & in-line single use variable that cannot be null.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git
The following commit(s) were added to refs/heads/master by this push:
new af157c49d Fix, lambda & in-line single use variable that cannot be null.
af157c49d is described below
commit af157c49d5adf5b48e7816bf5e9e6820e2c3fd52
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun May 15 16:01:00 2022 -0400
Fix, lambda & in-line single use variable that cannot be null.
---
src/main/java/org/apache/commons/lang3/time/CalendarUtils.java | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/time/CalendarUtils.java b/src/main/java/org/apache/commons/lang3/time/CalendarUtils.java
index 84f8d2128..ec5799baa 100644
--- a/src/main/java/org/apache/commons/lang3/time/CalendarUtils.java
+++ b/src/main/java/org/apache/commons/lang3/time/CalendarUtils.java
@@ -95,15 +95,12 @@ public class CalendarUtils {
String[] getMonthDisplayNames(final int style) {
// Unfortunately standalone month names are not available in DateFormatSymbols,
// so we have to extract them.
- final Calendar calendar = Calendar.getInstance(locale);
final Map<String, Integer> displayNames = calendar.getDisplayNames(Calendar.MONTH, style, locale);
if (displayNames == null) {
return null;
}
final String[] monthNames = new String[displayNames.size()];
- for (final Map.Entry<String, Integer> entry: displayNames.entrySet()) {
- monthNames[entry.getValue()] = entry.getKey();
- }
+ displayNames.forEach((k, v) -> monthNames[v] = k);
return monthNames;
}