Java 17 features (N-S) (#15565)

- 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-13 08:03:31 +02:00
committed by GitHub
parent 641b482551
commit ab58f4ffb4
471 changed files with 1624 additions and 1868 deletions

View File

@@ -12,7 +12,6 @@
*/
package org.openhab.binding.pushbullet.internal;
import java.util.Collections;
import java.util.Set;
import org.eclipse.jdt.annotation.NonNullByDefault;
@@ -32,7 +31,7 @@ public class PushbulletBindingConstants {
// List of all Thing Type UIDs
public static final ThingTypeUID THING_TYPE_BOT = new ThingTypeUID(BINDING_ID, "bot");
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections.singleton(THING_TYPE_BOT);
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Set.of(THING_TYPE_BOT);
// List of all Channel ids
public static final String RECIPIENT = "recipient";

View File

@@ -19,8 +19,8 @@ import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.Collection;
import java.util.Collections;
import java.util.Properties;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -97,7 +97,7 @@ public class PushbulletHandler extends BaseThingHandler {
@Override
public Collection<Class<? extends ThingHandlerService>> getServices() {
return Collections.singleton(PushbulletActions.class);
return Set.of(PushbulletActions.class);
}
public boolean sendPush(@Nullable String recipient, @Nullable String message, String type) {
@@ -129,8 +129,6 @@ public class PushbulletHandler extends BaseThingHandler {
logger.debug("Unpacked Response: {}", response);
stream.close();
if ((null != response) && (null == response.getPushError())) {
result = true;
}