Java 17 features (A-G) (#15516)

- add missing @override
- Java style array syntax
- remove redundant modifiers
- always move String constants to left side in comparisons
- simplify lambda expressions and return statements
- use replace instead of replaceAll w/o regex
- instanceof matching and multiline strings

Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
This commit is contained in:
Holger Friedrich
2023-09-05 22:30:16 +02:00
committed by GitHub
parent a0dc5c05f2
commit cf10b3e9c7
486 changed files with 2053 additions and 1955 deletions

View File

@@ -126,7 +126,7 @@ public class BuienradarHandler extends BaseThingHandler {
}
try {
final Optional<List<Prediction>> predictionsOpt = client.getPredictions(location);
if (!predictionsOpt.isPresent()) {
if (predictionsOpt.isEmpty()) {
// Did not get a result, retry the retrieval.
// Buienradar is not a very stable source and returns nothing quite regular
if (tries <= 2) {

View File

@@ -14,7 +14,6 @@ package org.openhab.binding.buienradar.internal;
import static org.openhab.binding.buienradar.internal.BuienradarBindingConstants.THING_TYPE_RAIN_FORECAST;
import java.util.Collections;
import java.util.Set;
import org.eclipse.jdt.annotation.NonNullByDefault;
@@ -36,7 +35,7 @@ import org.osgi.service.component.annotations.Component;
@Component(configurationPid = "binding.buienradar", service = ThingHandlerFactory.class)
public class BuienradarHandlerFactory extends BaseThingHandlerFactory {
private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections.singleton(THING_TYPE_RAIN_FORECAST);
private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Set.of(THING_TYPE_RAIN_FORECAST);
@Override
public boolean supportsThingType(ThingTypeUID thingTypeUID) {