Java 21 language features (#4535)

* Java 21 language features

* use getFirst and getLast methods
* replace new Locale by Locale.of
* replace Paths.get by Path.of
* use ThreadLocalRandom.current().nextDouble()
* add @Serial annotations

Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
This commit is contained in:
Holger Friedrich
2025-01-06 23:22:43 +01:00
committed by GitHub
parent f8fdd66f78
commit 40d079ae80
190 changed files with 594 additions and 443 deletions
@@ -72,7 +72,7 @@ public class Translations {
return 1;
}
return entries.get(0).getKey().compareTo(other.entries.get(0).getKey());
return entries.getFirst().getKey().compareTo(other.entries.getFirst().getKey());
}
public boolean hasTranslations() {
@@ -191,8 +191,7 @@ public class XmlToTranslationsConverter {
.map(ThingType::getConfigDescriptionURI) //
.distinct() //
.map(bundleInfo::getConfigDescription) //
.filter(Optional::isPresent) //
.map(Optional::get));
.flatMap(Optional::stream));
Builder<TranslationsGroup> groupsBuilder = Stream.builder();
@@ -314,8 +313,7 @@ public class XmlToTranslationsConverter {
.map(ChannelType::getConfigDescriptionURI) //
.distinct() //
.map(bundleInfo::getConfigDescription) //
.filter(Optional::isPresent) //
.map(Optional::get));
.flatMap(Optional::stream));
Builder<TranslationsGroup> groupsBuilder = Stream.builder();