Use new Collection API methods (#1598)

Using the new methods there will be less and more readable code.

Signed-off-by: Wouter Born <github@maindrain.net>
pull/1607/head
Wouter Born 2020-08-22 23:04:11 +02:00 committed by GitHub
parent 0173e23759
commit 057604cc2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
175 changed files with 706 additions and 1085 deletions

View File

@ -24,6 +24,7 @@ import java.net.URI;
import java.util.Collection;
import java.util.Collections;
import java.util.Locale;
import java.util.Map;
import java.util.function.BiFunction;
import org.junit.jupiter.api.AfterEach;
@ -231,8 +232,7 @@ public class AudioManagerTest {
audioManager.addAudioSource(audioSource);
if (isSourceDefault) {
audioManager
.modified(Collections.singletonMap(AudioManagerImpl.CONFIG_DEFAULT_SOURCE, audioSource.getId()));
audioManager.modified(Map.of(AudioManagerImpl.CONFIG_DEFAULT_SOURCE, audioSource.getId()));
} else {
// just to make sure there is no default source
audioManager.modified(Collections.emptyMap());
@ -250,10 +250,10 @@ public class AudioManagerTest {
audioManager.addAudioSink(audioSink);
if (isSinkDefault) {
audioManager.modified(Collections.singletonMap(AudioManagerImpl.CONFIG_DEFAULT_SINK, audioSink.getId()));
audioManager.modified(Map.of(AudioManagerImpl.CONFIG_DEFAULT_SINK, audioSink.getId()));
} else {
// just to make sure there is no default sink
audioManager.modified(Collections.emptyMap());
audioManager.modified(Map.of());
}
assertThat(String.format("The sink %s was not registered", audioSink.getId()), audioManager.getSink(),

View File

@ -13,11 +13,8 @@
package org.openhab.core.audio.internal.fake;
import java.io.IOException;
import java.util.Collections;
import java.util.Locale;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
@ -51,10 +48,9 @@ public class AudioSinkFake implements AudioSink {
public boolean isUnsupportedAudioFormatExceptionExpected;
public boolean isUnsupportedAudioStreamExceptionExpected;
private static final Set<AudioFormat> SUPPORTED_AUDIO_FORMATS = Collections
.unmodifiableSet(Stream.of(AudioFormat.MP3, AudioFormat.WAV).collect(Collectors.toSet()));
private static final Set<Class<? extends AudioStream>> SUPPORTED_AUDIO_STREAMS = Collections
.unmodifiableSet(Stream.of(FixedLengthAudioStream.class, URLAudioStream.class).collect(Collectors.toSet()));
private static final Set<AudioFormat> SUPPORTED_AUDIO_FORMATS = Set.of(AudioFormat.MP3, AudioFormat.WAV);
private static final Set<Class<? extends AudioStream>> SUPPORTED_AUDIO_STREAMS = Set
.of(FixedLengthAudioStream.class, URLAudioStream.class);
@Override
public String getId() {

View File

@ -12,10 +12,8 @@
*/
package org.openhab.core.automation.module.media.internal;
import static java.util.Arrays.asList;
import static java.util.Collections.unmodifiableList;
import java.util.Collection;
import java.util.List;
import org.openhab.core.audio.AudioManager;
import org.openhab.core.automation.Action;
@ -35,8 +33,7 @@ import org.osgi.service.component.annotations.Reference;
@Component(service = ModuleHandlerFactory.class)
public class MediaModuleHandlerFactory extends BaseModuleHandlerFactory {
private static final Collection<String> TYPES = unmodifiableList(
asList(SayActionHandler.TYPE_ID, PlayActionHandler.TYPE_ID));
private static final Collection<String> TYPES = List.of(SayActionHandler.TYPE_ID, PlayActionHandler.TYPE_ID);
private VoiceManager voiceManager;
private AudioManager audioManager;

View File

@ -13,9 +13,9 @@
package org.openhab.core.automation.module.media.internal;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
@ -56,12 +56,12 @@ public class MediaScriptScopeProvider implements ScriptExtensionProvider {
@Override
public Collection<String> getDefaultPresets() {
return Collections.singleton("media");
return Set.of("media");
}
@Override
public Collection<String> getPresets() {
return Collections.singleton("media");
return Set.of("media");
}
@Override

View File

@ -20,6 +20,7 @@ import java.nio.file.Paths;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import org.eclipse.jdt.annotation.NonNullByDefault;
@ -182,12 +183,12 @@ public class DefaultScriptScopeProvider implements ScriptExtensionProvider {
@Override
public Collection<String> getDefaultPresets() {
return Collections.singleton(PRESET_DEFAULT);
return Set.of(PRESET_DEFAULT);
}
@Override
public Collection<String> getPresets() {
return Collections.singleton(PRESET_DEFAULT);
return Set.of(PRESET_DEFAULT);
}
@Override

View File

@ -12,7 +12,6 @@
*/
package org.openhab.core.automation.module.script.internal.defaultscope;
import java.util.AbstractMap;
import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
@ -115,7 +114,7 @@ public class ItemRegistryDelegate implements Map<String, State> {
public Set<java.util.Map.Entry<String, State>> entrySet() {
Set<Map.Entry<String, State>> entries = new HashSet<>();
for (Item item : itemRegistry.getAll()) {
entries.add(new AbstractMap.SimpleEntry<>(item.getName(), item.getState()));
entries.add(Map.entry(item.getName(), item.getState()));
}
return entries;
}

View File

@ -17,6 +17,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import org.eclipse.jdt.annotation.NonNullByDefault;
@ -40,17 +41,17 @@ public class LifecycleScriptExtensionProvider implements ScriptExtensionProvider
@Override
public Collection<String> getDefaultPresets() {
return Collections.singleton(LIFECYCLE_PRESET_NAME);
return Set.of(LIFECYCLE_PRESET_NAME);
}
@Override
public Collection<String> getPresets() {
return Collections.singleton(LIFECYCLE_PRESET_NAME);
return Set.of(LIFECYCLE_PRESET_NAME);
}
@Override
public Collection<String> getTypes() {
return Collections.singleton(LIFECYCLE_TRACKER_NAME);
return Set.of(LIFECYCLE_TRACKER_NAME);
}
@Override
@ -67,7 +68,7 @@ public class LifecycleScriptExtensionProvider implements ScriptExtensionProvider
if (LIFECYCLE_PRESET_NAME.equals(preset)) {
final Object requestedType = get(scriptIdentifier, LIFECYCLE_TRACKER_NAME);
if (requestedType != null) {
return Collections.singletonMap(LIFECYCLE_TRACKER_NAME, requestedType);
return Map.of(LIFECYCLE_TRACKER_NAME, requestedType);
}
}

View File

@ -12,10 +12,8 @@
*/
package org.openhab.core.automation.module.script.internal.factory;
import static java.util.Arrays.asList;
import static java.util.Collections.unmodifiableList;
import java.util.Collection;
import java.util.List;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
@ -46,8 +44,8 @@ public class ScriptModuleHandlerFactory extends BaseModuleHandlerFactory {
private final Logger logger = LoggerFactory.getLogger(ScriptModuleHandlerFactory.class);
private static final Collection<String> TYPES = unmodifiableList(
asList(ScriptActionHandler.TYPE_ID, ScriptConditionHandler.TYPE_ID));
private static final Collection<String> TYPES = List.of(ScriptActionHandler.TYPE_ID,
ScriptConditionHandler.TYPE_ID);
private @NonNullByDefault({}) ScriptEngineManager scriptEngineManager;
@Override

View File

@ -14,7 +14,6 @@ package org.openhab.core.automation.internal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
@ -95,15 +94,11 @@ public class RuleImpl implements Rule {
this.uid = uid == null ? UUID.randomUUID().toString() : uid;
this.name = name;
this.description = description;
this.tags = tags == null ? Collections.emptySet() : Collections.unmodifiableSet(new HashSet<>(tags));
this.triggers = triggers == null ? Collections.emptyList()
: Collections.unmodifiableList(new ArrayList<>(triggers));
this.conditions = conditions == null ? Collections.emptyList()
: Collections.unmodifiableList(new ArrayList<>(conditions));
this.actions = actions == null ? Collections.emptyList()
: Collections.unmodifiableList(new ArrayList<>(actions));
this.configDescriptions = configDescriptions == null ? Collections.emptyList()
: Collections.unmodifiableList(new ArrayList<>(configDescriptions));
this.tags = tags == null ? Set.of() : Set.copyOf(tags);
this.triggers = triggers == null ? List.of() : List.copyOf(triggers);
this.conditions = conditions == null ? List.of() : List.copyOf(conditions);
this.actions = actions == null ? List.of() : List.copyOf(actions);
this.configDescriptions = configDescriptions == null ? List.of() : List.copyOf(configDescriptions);
this.configuration = configuration == null ? new Configuration()
: new Configuration(configuration.getProperties());
this.templateUID = templateUID;

View File

@ -13,9 +13,7 @@
package org.openhab.core.automation.internal.module.factory;
import java.util.Collection;
import java.util.Collections;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.List;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
@ -45,10 +43,9 @@ public class EphemerisModuleHandlerFactory extends BaseModuleHandlerFactory impl
private final Logger logger = LoggerFactory.getLogger(EphemerisModuleHandlerFactory.class);
private static final Collection<String> TYPES = Collections.unmodifiableList(Stream
.of(EphemerisConditionHandler.HOLIDAY_MODULE_TYPE_ID, EphemerisConditionHandler.WEEKEND_MODULE_TYPE_ID,
EphemerisConditionHandler.WEEKDAY_MODULE_TYPE_ID, EphemerisConditionHandler.DAYSET_MODULE_TYPE_ID)
.collect(Collectors.toList()));
private static final Collection<String> TYPES = List.of(EphemerisConditionHandler.HOLIDAY_MODULE_TYPE_ID,
EphemerisConditionHandler.WEEKEND_MODULE_TYPE_ID, EphemerisConditionHandler.WEEKDAY_MODULE_TYPE_ID,
EphemerisConditionHandler.DAYSET_MODULE_TYPE_ID);
private final EphemerisManager ephemerisManager;

View File

@ -12,11 +12,8 @@
*/
package org.openhab.core.automation.internal.module.handler;
import java.util.Arrays;
import java.util.Collections;
import java.util.Dictionary;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Map;
import java.util.Set;
@ -66,10 +63,9 @@ public class GenericEventTriggerHandler extends BaseTriggerModuleHandler impleme
this.source = (String) module.getConfiguration().get(CFG_EVENT_SOURCE);
this.topic = (String) module.getConfiguration().get(CFG_EVENT_TOPIC);
if (module.getConfiguration().get(CFG_EVENT_TYPES) != null) {
this.types = Collections.unmodifiableSet(
new HashSet<>(Arrays.asList(((String) module.getConfiguration().get(CFG_EVENT_TYPES)).split(","))));
this.types = Set.of(((String) module.getConfiguration().get(CFG_EVENT_TYPES)).split(","));
} else {
this.types = Collections.emptySet();
this.types = Set.of();
}
this.bundleContext = bundleContext;
Dictionary<String, Object> properties = new Hashtable<>();

View File

@ -12,7 +12,6 @@
*/
package org.openhab.core.automation.internal.module.handler;
import java.util.Collections;
import java.util.Dictionary;
import java.util.HashMap;
import java.util.Hashtable;
@ -67,7 +66,7 @@ public class GroupCommandTriggerHandler extends BaseTriggerModuleHandler impleme
super(module);
this.groupName = (String) module.getConfiguration().get(CFG_GROUPNAME);
this.command = (String) module.getConfiguration().get(CFG_COMMAND);
this.types = Collections.singleton(ItemCommandEvent.TYPE);
this.types = Set.of(ItemCommandEvent.TYPE);
this.bundleContext = bundleContext;
Dictionary<String, Object> properties = new Hashtable<>();
this.topic = "openhab/items/";

View File

@ -12,10 +12,8 @@
*/
package org.openhab.core.automation.internal.module.handler;
import java.util.Collections;
import java.util.Dictionary;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Map;
import java.util.Set;
@ -73,12 +71,9 @@ public class GroupStateTriggerHandler extends BaseTriggerModuleHandler implement
this.state = (String) module.getConfiguration().get(CFG_STATE);
this.previousState = (String) module.getConfiguration().get(CFG_PREVIOUS_STATE);
if (UPDATE_MODULE_TYPE_ID.equals(module.getTypeUID())) {
this.types = Collections.singleton(ItemStateEvent.TYPE);
this.types = Set.of(ItemStateEvent.TYPE);
} else {
Set<String> set = new HashSet<>();
set.add(ItemStateChangedEvent.TYPE);
set.add(GroupItemStateChangedEvent.TYPE);
this.types = Collections.unmodifiableSet(set);
this.types = Set.of(ItemStateChangedEvent.TYPE, GroupItemStateChangedEvent.TYPE);
}
this.bundleContext = bundleContext;
Dictionary<String, Object> properties = new Hashtable<>();

View File

@ -12,7 +12,6 @@
*/
package org.openhab.core.automation.internal.module.handler;
import java.util.Collections;
import java.util.Dictionary;
import java.util.HashMap;
import java.util.Hashtable;
@ -61,7 +60,7 @@ public class ItemCommandTriggerHandler extends BaseTriggerModuleHandler implemen
super(module);
this.itemName = (String) module.getConfiguration().get(CFG_ITEMNAME);
this.command = (String) module.getConfiguration().get(CFG_COMMAND);
this.types = Collections.singleton(ItemCommandEvent.TYPE);
this.types = Set.of(ItemCommandEvent.TYPE);
this.bundleContext = bundleContext;
Dictionary<String, Object> properties = new Hashtable<>();
this.topic = "openhab/items/" + itemName + "/command";

View File

@ -12,10 +12,8 @@
*/
package org.openhab.core.automation.internal.module.handler;
import java.util.Collections;
import java.util.Dictionary;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Map;
import java.util.Set;
@ -68,12 +66,9 @@ public class ItemStateTriggerHandler extends BaseTriggerModuleHandler implements
this.state = (String) module.getConfiguration().get(CFG_STATE);
this.previousState = (String) module.getConfiguration().get(CFG_PREVIOUS_STATE);
if (UPDATE_MODULE_TYPE_ID.equals(module.getTypeUID())) {
this.types = Collections.singleton(ItemStateEvent.TYPE);
this.types = Set.of(ItemStateEvent.TYPE);
} else {
Set<String> set = new HashSet<>();
set.add(ItemStateChangedEvent.TYPE);
set.add(GroupItemStateChangedEvent.TYPE);
this.types = Collections.unmodifiableSet(set);
this.types = Set.of(ItemStateChangedEvent.TYPE, GroupItemStateChangedEvent.TYPE);
}
this.bundleContext = bundleContext;
Dictionary<String, Object> properties = new Hashtable<>();

View File

@ -13,7 +13,6 @@
package org.openhab.core.automation.internal.module.handler;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.Dictionary;
import java.util.HashMap;
import java.util.Hashtable;
@ -59,7 +58,7 @@ public class SystemTriggerHandler extends BaseTriggerModuleHandler implements Ev
super(module);
this.startlevel = ((BigDecimal) module.getConfiguration().get(CFG_STARTLEVEL)).intValue();
if (STARTLEVEL_MODULE_TYPE_ID.equals(module.getTypeUID())) {
this.types = Collections.singleton(StartlevelEvent.TYPE);
this.types = Set.of(StartlevelEvent.TYPE);
} else {
logger.warn("Module type '{}' is not (yet) handled by this class.", module.getTypeUID());
throw new IllegalArgumentException(module.getTypeUID() + " is no valid module type.");

View File

@ -12,7 +12,6 @@
*/
package org.openhab.core.automation.internal.module.handler;
import java.util.Collections;
import java.util.Dictionary;
import java.util.HashMap;
import java.util.Hashtable;
@ -73,9 +72,9 @@ public class ThingStatusTriggerHandler extends BaseTriggerModuleHandler implemen
this.status = (String) module.getConfiguration().get(CFG_STATUS);
this.previousStatus = (String) module.getConfiguration().get(CFG_PREVIOUS_STATUS);
if (UPDATE_MODULE_TYPE_ID.equals(module.getTypeUID())) {
this.types = Collections.singleton(ThingStatusInfoEvent.TYPE);
this.types = Set.of(ThingStatusInfoEvent.TYPE);
} else {
this.types = Collections.singleton(ThingStatusInfoChangedEvent.TYPE);
this.types = Set.of(ThingStatusInfoChangedEvent.TYPE);
}
this.bundleContext = bundleContext;
Dictionary<String, Object> properties = new Hashtable<>();

View File

@ -17,7 +17,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.Mockito.*;
import java.util.Collections;
import java.util.Map;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.junit.jupiter.api.BeforeEach;
@ -60,7 +60,7 @@ public class EphemerisModuleHandlerFactoryTest {
public void testFactoryCreatesModuleHandlerForDaysetCondition() {
when(moduleMock.getTypeUID()).thenReturn(EphemerisConditionHandler.DAYSET_MODULE_TYPE_ID);
when(moduleMock.getConfiguration()).thenReturn(new Configuration(Collections.singletonMap("dayset", "school")));
when(moduleMock.getConfiguration()).thenReturn(new Configuration(Map.of("dayset", "school")));
ModuleHandler handler = factory.internalCreate(moduleMock, "My second rule");
assertThat(handler, is(notNullValue()));
assertThat(handler, instanceOf(EphemerisConditionHandler.class));
@ -75,7 +75,7 @@ public class EphemerisModuleHandlerFactoryTest {
assertThat(handler, is(notNullValue()));
assertThat(handler, instanceOf(EphemerisConditionHandler.class));
when(moduleMock.getConfiguration()).thenReturn(new Configuration(Collections.singletonMap("offset", 5)));
when(moduleMock.getConfiguration()).thenReturn(new Configuration(Map.of("offset", 5)));
handler = factory.internalCreate(moduleMock, "My second rule");
assertThat(handler, is(notNullValue()));
assertThat(handler, instanceOf(EphemerisConditionHandler.class));

View File

@ -15,7 +15,6 @@ package org.openhab.core.automation.util;
import static org.junit.jupiter.api.Assertions.*;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -154,14 +153,14 @@ public class ReferenceResolverUtilTest {
@Test
public void testGetFromList() {
String ken = "Ken";
List<String> names = Arrays.asList("John", ken, "Sue");
List<String> names = List.of("John", ken, "Sue");
assertEquals(ken,
ReferenceResolver.resolveComplexDataReference(names, ReferenceResolver.splitReferenceToTokens("[1]")));
}
@Test
public void testGetFromListInvalidIndexFormat() {
List<String> names = Arrays.asList("John", "Ken", "Sue");
List<String> names = List.of("John", "Ken", "Sue");
assertThrows(NumberFormatException.class, () -> ReferenceResolver.resolveComplexDataReference(names,
ReferenceResolver.splitReferenceToTokens("[Ten]")));
}
@ -169,10 +168,7 @@ public class ReferenceResolverUtilTest {
@Test
public void getFromMap() {
String phone = "0331 1387 121";
Map<String, String> phones = new HashMap<>();
phones.put("John", phone);
phones.put("Sue", "0222 2184 121");
phones.put("Mark", "0222 5641 121");
Map<String, String> phones = Map.of("John", phone, "Sue", "0222 2184 121", "Mark", "0222 5641 121");
assertEquals(phone, ReferenceResolver.resolveComplexDataReference(phones,
ReferenceResolver.splitReferenceToTokens("[\"John\"]")));
}
@ -180,19 +176,14 @@ public class ReferenceResolverUtilTest {
@Test
public void getFromMapWithKeyThatContainsSpecialCharacters() {
String phone = "0331 1387 121";
Map<String, String> phones = new HashMap<>();
phones.put("John[].Smi\"th].", phone);
phones.put("Sue", "0222 2184 121");
phones.put("Mark", "0222 5641 121");
Map<String, String> phones = Map.of("John[].Smi\"th].", phone, "Sue", "0222 2184 121", "Mark", "0222 5641 121");
assertEquals(phone, ReferenceResolver.resolveComplexDataReference(phones,
ReferenceResolver.splitReferenceToTokens("[\"John[].Smi\"th].\"]")));
}
@Test
public void getFromMapUnExistingKey() {
Map<String, String> phones = new HashMap<>();
phones.put("Sue", "0222 2184 121");
phones.put("Mark", "0222 5641 121");
Map<String, String> phones = Map.of("Sue", "0222 2184 121", "Mark", "0222 5641 121");
assertNull(ReferenceResolver.resolveComplexDataReference(phones,
ReferenceResolver.splitReferenceToTokens("[\"John\"]")));
}
@ -200,21 +191,21 @@ public class ReferenceResolverUtilTest {
@Test
public void getFromList() {
String ken = "Ken";
List<String> names = Arrays.asList(new String[] { "John", ken, "Sue" });
List<String> names = List.of("John", ken, "Sue");
assertEquals(ken,
ReferenceResolver.resolveComplexDataReference(names, ReferenceResolver.splitReferenceToTokens("[1]")));
}
@Test
public void testGetFromListInvalidIndex() {
List<String> names = Arrays.asList(new String[] { "John", "Ken", "Sue" });
List<String> names = List.of("John", "Ken", "Sue");
assertThrows(ArrayIndexOutOfBoundsException.class, () -> ReferenceResolver.resolveComplexDataReference(names,
ReferenceResolver.splitReferenceToTokens("[10]")));
}
@Test
public void testGetFromInvalidIndexFormat() {
List<String> names = Arrays.asList(new String[] { "John", "Ken", "Sue" });
List<String> names = List.of("John", "Ken", "Sue");
assertThrows(NumberFormatException.class, () -> ReferenceResolver.resolveComplexDataReference(names,
ReferenceResolver.splitReferenceToTokens("[Ten]")));
}
@ -238,8 +229,7 @@ public class ReferenceResolverUtilTest {
@Test
public void testBeanFromBean() {
String phone = "0331 1387 121";
Map<String, String> phones = new HashMap<>();
phones.put("John", phone);
Map<String, String> phones = Map.of("John", phone);
B1<Map<String, String>> b3 = new B1<>(phones);
B2<B1<Map<String, String>>> b4 = new B2<>(b3);
assertEquals(phone, ReferenceResolver.resolveComplexDataReference(b4,
@ -252,7 +242,7 @@ public class ReferenceResolverUtilTest {
B1<String> b31 = new B1<>("Ken");
B1<String> b32 = new B1<>("Sue");
B1<String> b33 = new B1<>(name);
List<B1<String>> b = Arrays.asList(b31, b32, b33);
List<B1<String>> b = List.of(b31, b32, b33);
assertEquals(name, ReferenceResolver.resolveComplexDataReference(b,
ReferenceResolver.splitReferenceToTokens("[2].value")));
}

View File

@ -14,9 +14,7 @@ package org.openhab.core.config.core;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
@ -104,10 +102,9 @@ public class ConfigDescriptionParameter {
private boolean advanced = false;
private boolean verify = false;
private static final Set<String> UNITS = Collections
.unmodifiableSet(new HashSet<>(Arrays.asList("A", "cd", "K", "kg", "m", "mol", "s", "g", "rad", "sr", "Hz",
"N", "Pa", "J", "W", "C", "V", "F", "Ω", "S", "Wb", "T", "H", "Cel", "lm", "lx", "Bq", "Gy", "Sv",
"kat", "m/s2", "m2v", "m3", "kph", "%", "l", "ms", "min", "h", "d", "week", "y")));
private static final Set<String> UNITS = Set.of("A", "cd", "K", "kg", "m", "mol", "s", "g", "rad", "sr", "Hz", "N",
"Pa", "J", "W", "C", "V", "F", "Ω", "S", "Wb", "T", "H", "Cel", "lm", "lx", "Bq", "Gy", "Sv", "kat", "m/s2",
"m2v", "m3", "kph", "%", "l", "ms", "min", "h", "d", "week", "y");
/**
* Default constructor.

View File

@ -112,7 +112,7 @@ public class ConfigUtil {
if (defaultValue != null && configuration.get(parameter.getName()) == null) {
if (parameter.isMultiple()) {
if (defaultValue.contains(DEFAULT_LIST_DELIMITER)) {
List<Object> values = Arrays.asList(defaultValue.split(DEFAULT_LIST_DELIMITER)).stream()
List<Object> values = List.of(defaultValue.split(DEFAULT_LIST_DELIMITER)).stream()
.map(v -> v.trim()).filter(v -> !v.isEmpty())
.map(v -> ConfigUtil.getDefaultValueAsCorrectType(parameter.getName(),
parameter.getType(), v))

View File

@ -20,7 +20,6 @@ import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@ -161,7 +160,7 @@ public class ConfigMapper {
final Enum<?> enumvalue = Enum.valueOf(enumType, value.toString());
result = enumvalue;
} else if (Collection.class.isAssignableFrom(type)) {
result = Collections.singletonList(value);
result = List.of(value);
}
}
return result;

View File

@ -12,12 +12,9 @@
*/
package org.openhab.core.config.core.internal.normalization;
import java.util.AbstractMap.SimpleEntry;
import java.util.Collections;
import static java.util.Map.entry;
import java.util.Map;
import java.util.Map.Entry;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.openhab.core.config.core.ConfigDescriptionParameter;
import org.openhab.core.config.core.ConfigDescriptionParameter.Type;
@ -31,12 +28,9 @@ import org.openhab.core.config.core.ConfigDescriptionParameter.Type;
*/
public final class NormalizerFactory {
private static final Map<Type, Normalizer> NORMALIZERS = Collections.unmodifiableMap(Stream
.of(new SimpleEntry<>(Type.BOOLEAN, new BooleanNormalizer()),
new SimpleEntry<>(Type.TEXT, new TextNormalizer()),
new SimpleEntry<>(Type.INTEGER, new IntNormalizer()),
new SimpleEntry<>(Type.DECIMAL, new DecimalNormalizer()))
.collect(Collectors.toMap(Entry::getKey, Entry::getValue)));
private static final Map<Type, Normalizer> NORMALIZERS = Map.ofEntries(entry(Type.BOOLEAN, new BooleanNormalizer()),
entry(Type.TEXT, new TextNormalizer()), entry(Type.INTEGER, new IntNormalizer()),
entry(Type.DECIMAL, new DecimalNormalizer()));
private NormalizerFactory() {
// prevent instantiation

View File

@ -12,13 +12,10 @@
*/
package org.openhab.core.config.core.internal.validation;
import static java.util.Map.entry;
import java.math.BigDecimal;
import java.util.AbstractMap.SimpleEntry;
import java.util.Collections;
import java.util.Map;
import java.util.Map.Entry;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.openhab.core.config.core.ConfigDescriptionParameter.Type;
@ -30,12 +27,9 @@ import org.openhab.core.config.core.ConfigDescriptionParameter.Type;
*/
final class TypeIntrospections {
private static final Map<Type, TypeIntrospection> INTROSPECTIONS = Collections.unmodifiableMap(Stream
.of(new SimpleEntry<>(Type.BOOLEAN, new BooleanIntrospection()),
new SimpleEntry<>(Type.TEXT, new StringIntrospection()),
new SimpleEntry<>(Type.INTEGER, new IntegerIntrospection()),
new SimpleEntry<>(Type.DECIMAL, new FloatIntrospection()))
.collect(Collectors.toMap(Entry::getKey, Entry::getValue)));
private static final Map<Type, TypeIntrospection> INTROSPECTIONS = Map.ofEntries(
entry(Type.BOOLEAN, new BooleanIntrospection()), entry(Type.TEXT, new StringIntrospection()),
entry(Type.INTEGER, new IntegerIntrospection()), entry(Type.DECIMAL, new FloatIntrospection()));
private TypeIntrospections() {
super();

View File

@ -12,7 +12,6 @@
*/
package org.openhab.core.config.core.status.events;
import java.util.Collections;
import java.util.Set;
import org.openhab.core.config.core.status.ConfigStatusInfo;
@ -30,7 +29,7 @@ import org.osgi.service.component.annotations.Component;
@Component(immediate = true, service = { EventFactory.class })
public final class ConfigStatusEventFactory extends AbstractEventFactory {
private static final Set<String> SUPPORTED_EVENT_TYPES = Collections.singleton(ConfigStatusInfoEvent.TYPE);
private static final Set<String> SUPPORTED_EVENT_TYPES = Set.of(ConfigStatusInfoEvent.TYPE);
/**
* Creates a new {@link ConfigStatusEventFactory}.

View File

@ -17,7 +17,6 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
import java.net.URI;
import java.util.Arrays;
import java.util.List;
import org.junit.jupiter.api.BeforeEach;
@ -66,7 +65,7 @@ public class ConfigDescriptionBuilderTest {
@Test
public void testWithTwoParameters() {
final List<ConfigDescriptionParameter> params = Arrays.asList(PARAM1, PARAM2);
final List<ConfigDescriptionParameter> params = List.of(PARAM1, PARAM2);
ConfigDescription configDescription = builder.withParameters(params).build();
assertThat(configDescription.getUID(), is(CONFIG_URI));
@ -86,7 +85,7 @@ public class ConfigDescriptionBuilderTest {
@Test
public void testWithTwoParameterGroups() {
final List<ConfigDescriptionParameterGroup> groups = Arrays.asList(GROUP1, GROUP2);
final List<ConfigDescriptionParameterGroup> groups = List.of(GROUP1, GROUP2);
ConfigDescription configDescription = builder.withParameterGroups(groups).build();
assertThat(configDescription.getUID(), is(CONFIG_URI));

View File

@ -17,7 +17,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.*;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import org.junit.jupiter.api.Test;
import org.openhab.core.config.core.ConfigDescriptionParameter.Type;
@ -67,8 +67,8 @@ public class ConfigDescriptionParameterBuilderTest {
.withDefault(defaultVal)
.withLabel(label)
.withDescription(description)
.withOptions(Arrays.asList(options))
.withFilterCriteria(Arrays.asList(criterias))
.withOptions(List.of(options))
.withFilterCriteria(List.of(criterias))
.withGroupName(groupName)
.withAdvanced(advanced)
.withLimitToOptions(limitToOptions)

View File

@ -20,8 +20,8 @@ import static org.mockito.Mockito.when;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@ -68,39 +68,36 @@ public class ConfigDescriptionRegistryTest extends JavaTest {
.create("param1", ConfigDescriptionParameter.Type.INTEGER).build();
configDescription = ConfigDescriptionBuilder.create(uriDummy).withParameter(param1).build();
when(configDescriptionProviderMock.getConfigDescriptions(any()))
.thenReturn(Collections.singleton(configDescription));
when(configDescriptionProviderMock.getConfigDescriptions(any())).thenReturn(Set.of(configDescription));
when(configDescriptionProviderMock.getConfigDescription(eq(uriDummy), any())).thenReturn(configDescription);
configDescription1 = ConfigDescriptionBuilder.create(uriDummy1).build();
when(configDescriptionProviderMock1.getConfigDescriptions(any()))
.thenReturn(Collections.singleton(configDescription1));
when(configDescriptionProviderMock1.getConfigDescriptions(any())).thenReturn(Set.of(configDescription1));
when(configDescriptionProviderMock1.getConfigDescription(eq(uriDummy1), any())).thenReturn(configDescription1);
configDescriptionAliased = ConfigDescriptionBuilder.create(uriAliases).withParameter(
ConfigDescriptionParameterBuilder.create("instanceId", ConfigDescriptionParameter.Type.INTEGER).build())
.build();
when(configDescriptionProviderAliased.getConfigDescriptions(any()))
.thenReturn(Collections.singleton(configDescriptionAliased));
.thenReturn(Set.of(configDescriptionAliased));
when(configDescriptionProviderAliased.getConfigDescription(eq(uriAliases), any()))
.thenReturn(configDescriptionAliased);
ConfigDescriptionParameter param2 = ConfigDescriptionParameterBuilder
.create("param2", ConfigDescriptionParameter.Type.INTEGER).build();
configDescription2 = ConfigDescriptionBuilder.create(uriDummy).withParameter(param2).build();
when(configDescriptionProviderMock2.getConfigDescriptions(any()))
.thenReturn(Collections.singleton(configDescription2));
when(configDescriptionProviderMock2.getConfigDescriptions(any())).thenReturn(Set.of(configDescription2));
when(configDescriptionProviderMock2.getConfigDescription(eq(uriDummy), any())).thenReturn(configDescription2);
when(aliasProvider.getAlias(eq(uriAliases))).thenReturn(uriDummy);
when(configOptionsProviderMockAliased.getParameterOptions(eq(uriAliases), anyString(), any(), any()))
.thenReturn(Collections.singletonList(new ParameterOption("Option", "Aliased")));
.thenReturn(List.of(new ParameterOption("Option", "Aliased")));
when(configOptionsProviderMockAliased.getParameterOptions(eq(uriDummy), anyString(), any(), any()))
.thenReturn(null);
when(configOptionsProviderMock.getParameterOptions(eq(uriDummy), anyString(), any(), any()))
.thenReturn(Collections.singletonList(new ParameterOption("Option", "Original")));
.thenReturn(List.of(new ParameterOption("Option", "Original")));
when(configOptionsProviderMock.getParameterOptions(eq(uriAliases), anyString(), any(), any())).thenReturn(null);
}

View File

@ -19,9 +19,8 @@ import static org.openhab.core.config.core.ConfigDescriptionParameter.Type.*;
import java.math.BigDecimal;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.junit.jupiter.api.Test;
@ -124,7 +123,7 @@ public class ConfigUtilTest {
.withParameter(configDescriptionParameterBuilder1.build()).build();
ConfigUtil.applyDefaultConfiguration(configuration, configDescription);
verifyValuesOfConfiguration(configuration.get("p1"), 1, Collections.singletonList(new BigDecimal("2.5")));
verifyValuesOfConfiguration(configuration.get("p1"), 1, List.of(new BigDecimal("2.5")));
}
@Test
@ -137,7 +136,7 @@ public class ConfigUtilTest {
ConfigUtil.applyDefaultConfiguration(configuration, configDescription);
verifyValuesOfConfiguration(configuration.get("p1"), 3,
Arrays.asList(new BigDecimal("2.3"), new BigDecimal("2.4"), new BigDecimal("2.5")));
List.of(new BigDecimal("2.3"), new BigDecimal("2.4"), new BigDecimal("2.5")));
}
@Test
@ -150,7 +149,7 @@ public class ConfigUtilTest {
ConfigUtil.applyDefaultConfiguration(configuration, configDescription);
verifyValuesOfConfiguration(configuration.get("p1"), 3,
Arrays.asList(new BigDecimal("2.3"), new BigDecimal("2.4"), new BigDecimal("2.5")));
List.of(new BigDecimal("2.3"), new BigDecimal("2.4"), new BigDecimal("2.5")));
}
@Test
@ -162,8 +161,7 @@ public class ConfigUtilTest {
.withParameter(configDescriptionParameterBuilder2.build()).build();
ConfigUtil.applyDefaultConfiguration(configuration, configDescription);
verifyValuesOfConfiguration(configuration.get("p2"), 3,
Arrays.asList("first value", "second value", "third value"));
verifyValuesOfConfiguration(configuration.get("p2"), 3, List.of("first value", "second value", "third value"));
}
private void verifyValuesOfConfiguration(Object subject, int expectedSize, List<?> expectedValues) {
@ -181,21 +179,15 @@ public class ConfigUtilTest {
ConfigDescription configDescriptionString = ConfigDescriptionBuilder.create(new URI("thingType:fooThing"))
.withParameter(ConfigDescriptionParameterBuilder.create("foo", TEXT).build()).build();
assertThat(
ConfigUtil.normalizeTypes(Collections.singletonMap("foo", "1"), Arrays.asList(configDescriptionInteger))
.get("foo"),
assertThat(ConfigUtil.normalizeTypes(Map.of("foo", "1"), List.of(configDescriptionInteger)).get("foo"),
is(instanceOf(BigDecimal.class)));
assertThat(
ConfigUtil.normalizeTypes(Collections.singletonMap("foo", "1"), Arrays.asList(configDescriptionString))
.get("foo"),
is(instanceOf(String.class)));
assertThat(
ConfigUtil.normalizeTypes(Collections.singletonMap("foo", "1"),
Arrays.asList(configDescriptionInteger, configDescriptionString)).get("foo"),
is(instanceOf(BigDecimal.class)));
assertThat(
ConfigUtil.normalizeTypes(Collections.singletonMap("foo", "1"),
Arrays.asList(configDescriptionString, configDescriptionInteger)).get("foo"),
assertThat(ConfigUtil.normalizeTypes(Map.of("foo", "1"), List.of(configDescriptionString)).get("foo"),
is(instanceOf(String.class)));
assertThat(ConfigUtil
.normalizeTypes(Map.of("foo", "1"), List.of(configDescriptionInteger, configDescriptionString))
.get("foo"), is(instanceOf(BigDecimal.class)));
assertThat(ConfigUtil
.normalizeTypes(Map.of("foo", "1"), List.of(configDescriptionString, configDescriptionInteger))
.get("foo"), is(instanceOf(String.class)));
}
}

View File

@ -18,7 +18,6 @@ import static org.hamcrest.core.IsIterableContaining.hasItems;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -62,7 +61,7 @@ public class ConfigurationTest {
configuration.put("booleanField", false);
configuration.put("stringField", "test");
configuration.put("enumField", "ON");
configuration.put("listField", Arrays.asList("one", "two", "three"));
configuration.put("listField", List.of("one", "two", "three"));
configuration.put("notExisitingProperty", true);
ConfigClass configClass = configuration.as(ConfigClass.class);

View File

@ -18,8 +18,8 @@ import static org.mockito.Mockito.when;
import static org.openhab.core.config.core.internal.metadata.MetadataConfigDescriptionProviderImpl.*;
import java.net.URI;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Locale;
import org.junit.jupiter.api.BeforeEach;
@ -64,11 +64,11 @@ public class MetadataConfigDescriptionProviderImplTest extends JavaTest {
when(mockProviderRestricted.getNamespace()).thenReturn(RESTRICTED);
when(mockProviderRestricted.getDescription(any())).thenReturn("Restricted");
when(mockProviderRestricted.getParameterOptions(any())).thenReturn(Arrays.asList( //
when(mockProviderRestricted.getParameterOptions(any())).thenReturn(List.of( //
new ParameterOption("dimmer", "Dimmer"), //
new ParameterOption("switch", "Switch") //
));
when(mockProviderRestricted.getParameters(eq("dimmer"), any())).thenReturn(Arrays.asList( //
when(mockProviderRestricted.getParameters(eq("dimmer"), any())).thenReturn(List.of( //
ConfigDescriptionParameterBuilder.create("width", Type.INTEGER).build(), //
ConfigDescriptionParameterBuilder.create("height", Type.INTEGER).build() //
));

View File

@ -23,7 +23,6 @@ import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@ -243,7 +242,7 @@ public class ConfigDescriptionValidatorTest {
}
void assertRequired(String parameterName) {
List<ConfigValidationMessage> expected = Collections.singletonList(new ConfigValidationMessage(parameterName,
List<ConfigValidationMessage> expected = List.of(new ConfigValidationMessage(parameterName,
MessageKey.PARAMETER_REQUIRED.defaultMessage, MessageKey.PARAMETER_REQUIRED.key));
try {
@ -326,8 +325,8 @@ public class ConfigDescriptionValidatorTest {
}
void assertMinMax(String parameterName, Object value, MessageKey msgKey, String minMax) {
List<ConfigValidationMessage> expected = Collections
.singletonList(new ConfigValidationMessage(parameterName, msgKey.defaultMessage, msgKey.key, minMax));
List<ConfigValidationMessage> expected = List
.of(new ConfigValidationMessage(parameterName, msgKey.defaultMessage, msgKey.key, minMax));
try {
params.put(parameterName, value);
configDescriptionValidator.validate(params, CONFIG_DESCRIPTION_URI);
@ -386,7 +385,7 @@ public class ConfigDescriptionValidatorTest {
}
void assertType(String parameterName, Type type) {
List<ConfigValidationMessage> expected = Collections.singletonList(new ConfigValidationMessage(parameterName,
List<ConfigValidationMessage> expected = List.of(new ConfigValidationMessage(parameterName,
MessageKey.DATA_TYPE_VIOLATED.defaultMessage, MessageKey.DATA_TYPE_VIOLATED.key, type));
try {
params.put(parameterName, INVALID);
@ -403,8 +402,8 @@ public class ConfigDescriptionValidatorTest {
@Test
public void assertValidationThrowsExceptionContainingMessagesForInvalidPatternForTxtConfigParameters() {
List<ConfigValidationMessage> expected = Collections.singletonList(
new ConfigValidationMessage(TXT_PATTERN_PARAM_NAME, MessageKey.PATTERN_VIOLATED.defaultMessage,
List<ConfigValidationMessage> expected = List
.of(new ConfigValidationMessage(TXT_PATTERN_PARAM_NAME, MessageKey.PATTERN_VIOLATED.defaultMessage,
MessageKey.PATTERN_VIOLATED.key, String.valueOf(MAX_VIOLATED), PATTERN));
try {
params.put(TXT_PATTERN_PARAM_NAME, String.valueOf(MAX_VIOLATED));
@ -455,9 +454,9 @@ public class ConfigDescriptionValidatorTest {
@Test
public void assertValidationProvidesOnlyOneMessagePerParameterAlthoughMultipleViolationsOccur() {
List<ConfigValidationMessage> expected = Collections.singletonList(new ConfigValidationMessage(
TXT_MAX_PATTERN_PARAM_NAME, MessageKey.MAX_VALUE_TXT_VIOLATED.defaultMessage,
MessageKey.MAX_VALUE_TXT_VIOLATED.key, MAX.toString()));
List<ConfigValidationMessage> expected = List.of(new ConfigValidationMessage(TXT_MAX_PATTERN_PARAM_NAME,
MessageKey.MAX_VALUE_TXT_VIOLATED.defaultMessage, MessageKey.MAX_VALUE_TXT_VIOLATED.key,
MAX.toString()));
try {
params.put(TXT_MAX_PATTERN_PARAM_NAME, String.valueOf(MAX_VIOLATED));
configDescriptionValidator.validate(params, CONFIG_DESCRIPTION_URI);

View File

@ -12,8 +12,6 @@
*/
package org.openhab.core.config.core.internal.validation;
import static java.util.Collections.*;
import static java.util.stream.Collectors.toList;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertThrows;
@ -23,7 +21,6 @@ import java.util.Collection;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.stream.Stream;
import org.eclipse.jdt.annotation.Nullable;
import org.junit.jupiter.api.Test;
@ -59,11 +56,11 @@ public class ConfigValidationExceptionTest {
MAX);
private static final ConfigValidationMessage MSG1 = createMessage(PARAM1, TXT_DEFAULT1,
MessageKey.PARAMETER_REQUIRED.key, emptyList());
MessageKey.PARAMETER_REQUIRED.key, List.of());
private static final ConfigValidationMessage MSG2 = createMessage(PARAM2, TXT_DEFAULT2,
MessageKey.MAX_VALUE_TXT_VIOLATED.key, singletonList(MAX));
MessageKey.MAX_VALUE_TXT_VIOLATED.key, List.of(MAX));
private static final List<ConfigValidationMessage> ALL = Stream.of(MSG1, MSG2).collect(toList());
private static final List<ConfigValidationMessage> ALL = List.of(MSG1, MSG2);
private static final Bundle BUNDLE = Mockito.mock(Bundle.class);

View File

@ -12,13 +12,14 @@
*/
package org.openhab.core.config.core.status;
import static java.util.Collections.*;
import static java.util.stream.Collectors.*;
import static java.util.Collections.emptySet;
import static java.util.stream.Collectors.toList;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.List;
import java.util.Set;
import java.util.stream.Stream;
import org.junit.jupiter.api.Test;
@ -129,14 +130,9 @@ public class ConfigStatusInfoTest {
assertThat(info.getConfigStatusMessages(PARAM3, PARAM4).size(), is(2));
assertThat(info.getConfigStatusMessages(PARAM3, PARAM4), hasItems(MSG3, MSG4));
assertThat(info
.getConfigStatusMessages(unmodifiableSet(Stream.of(Type.INFORMATION, Type.WARNING).collect(toSet())),
unmodifiableSet(Stream.of(PARAM1, PARAM6).collect(toSet())))
.size(), is(5));
assertThat(
info.getConfigStatusMessages(
unmodifiableSet(Stream.of(Type.INFORMATION, Type.WARNING).collect(toSet())),
unmodifiableSet(Stream.of(PARAM1, PARAM6).collect(toSet()))),
assertThat(info.getConfigStatusMessages(Set.of(Type.INFORMATION, Type.WARNING), Set.of(PARAM1, PARAM6)).size(),
is(5));
assertThat(info.getConfigStatusMessages(Set.of(Type.INFORMATION, Type.WARNING), Set.of(PARAM1, PARAM6)),
hasItems(MSG1, MSG2, MSG3, MSG4, MSG6));
assertThat(info.getConfigStatusMessages("unknown").size(), is(0));

View File

@ -13,10 +13,8 @@
package org.openhab.core.config.discovery;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CancellationException;
@ -88,18 +86,11 @@ public abstract class AbstractDiscoveryService implements DiscoveryService {
*/
public AbstractDiscoveryService(@Nullable Set<ThingTypeUID> supportedThingTypes, int timeout,
boolean backgroundDiscoveryEnabledByDefault) throws IllegalArgumentException {
if (supportedThingTypes == null) {
this.supportedThingTypes = Collections.emptySet();
} else {
this.supportedThingTypes = Collections.unmodifiableSet(new HashSet<>(supportedThingTypes));
}
if (timeout < 0) {
throw new IllegalArgumentException("The timeout must be >= 0!");
}
this.supportedThingTypes = supportedThingTypes == null ? Set.of() : Set.copyOf(supportedThingTypes);
this.timeout = timeout;
this.backgroundDiscoveryEnabled = backgroundDiscoveryEnabledByDefault;
}

View File

@ -14,7 +14,6 @@ package org.openhab.core.config.discovery.internal.console;
import static org.openhab.core.config.discovery.inbox.InboxPredicates.*;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -193,12 +192,12 @@ public class InboxConsoleCommandExtension extends AbstractConsoleCommandExtensio
@Override
public List<String> getUsages() {
return Arrays.asList(new String[] { buildCommandUsage(SUBCMD_LIST, "lists all current inbox entries"),
return List.of(buildCommandUsage(SUBCMD_LIST, "lists all current inbox entries"),
buildCommandUsage(SUBCMD_LIST_IGNORED, "lists all ignored inbox entries"),
buildCommandUsage(SUBCMD_APPROVE + " <thingUID> <label>", "creates a thing for an inbox entry"),
buildCommandUsage(SUBCMD_CLEAR, "clears all current inbox entries"),
buildCommandUsage(SUBCMD_REMOVE + " [<thingUID>|<thingTypeUID>]",
"remove the inbox entries of a given thing id or thing type"),
buildCommandUsage(SUBCMD_IGNORE + " <thingUID>", "ignores an inbox entry permanently") });
buildCommandUsage(SUBCMD_IGNORE + " <thingUID>", "ignores an inbox entry permanently"));
}
}

View File

@ -12,18 +12,14 @@
*/
package org.openhab.core.config.discovery.inbox;
import static java.util.Map.entry;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.openhab.core.config.discovery.inbox.InboxPredicates.*;
import java.util.AbstractMap.SimpleEntry;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@ -61,12 +57,10 @@ public class InboxPredicatesTest {
private static final ThingTypeUID THING_TYPE_UID12 = new ThingTypeUID(BINDING_ID1, THING_TYPE_ID2);
private static final ThingTypeUID THING_TYPE_UID21 = new ThingTypeUID(BINDING_ID2, THING_TYPE_ID1);
private static final Map<String, Object> PROPS1 = Collections
.unmodifiableMap(Stream.of(new SimpleEntry<>(PROP1, PROP_VAL1), new SimpleEntry<>(PROP2, PROP_VAL2))
.collect(Collectors.toMap(Entry::getKey, Entry::getValue)));
private static final Map<String, Object> PROPS2 = Collections.singletonMap(PROP2, PROP_VAL2);
private static final Map<String, Object> PROPS1 = Map.ofEntries(entry(PROP1, PROP_VAL1), entry(PROP2, PROP_VAL2));
private static final Map<String, Object> PROPS2 = Map.of(PROP2, PROP_VAL2);
private static final List<DiscoveryResult> RESULTS = Arrays.asList(
private static final List<DiscoveryResult> RESULTS = List.of(
DiscoveryResultBuilder.create(THING_UID11).withThingType(THING_TYPE_UID11).withProperties(PROPS1)
.withRepresentationProperty(PROP1).withLabel("label").build(),
DiscoveryResultBuilder.create(THING_UID12).withThingType(THING_TYPE_UID11).withProperties(PROPS1)

View File

@ -87,10 +87,10 @@ public class AutomaticInboxProcessorTest {
private static final ThingType THING_TYPE3 = ThingTypeBuilder.instance(THING_TYPE_UID3, "label").isListed(true)
.withRepresentationProperty(OTHER_KEY).build();
private static final Map<String, String> THING_PROPERTIES = Collections.singletonMap(DEVICE_ID_KEY, DEVICE_ID);
private static final Map<String, String> OTHER_THING_PROPERTIES = Collections.singletonMap(OTHER_KEY, OTHER_VALUE);
private static final Map<String, String> THING_PROPERTIES = Map.of(DEVICE_ID_KEY, DEVICE_ID);
private static final Map<String, String> OTHER_THING_PROPERTIES = Map.of(OTHER_KEY, OTHER_VALUE);
private static final Configuration CONFIG = new Configuration(Collections.singletonMap(CONFIG_KEY, CONFIG_VALUE));
private static final Configuration CONFIG = new Configuration(Map.of(CONFIG_KEY, CONFIG_VALUE));
private AutomaticInboxProcessor automaticInboxProcessor;
private PersistentInbox inbox;

View File

@ -21,8 +21,8 @@ import static org.mockito.Mockito.*;
import java.math.BigDecimal;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.jupiter.api.BeforeEach;
@ -134,7 +134,7 @@ public class PersistentInboxTest {
public void testApproveNormalization() throws URISyntaxException {
DiscoveryResult result = DiscoveryResultBuilder.create(THING_UID).withProperty("foo", 3).build();
configureConfigDescriptionRegistryMock("foo", Type.TEXT);
when(storage.getValues()).thenReturn(Collections.singletonList(result));
when(storage.getValues()).thenReturn(List.of(result));
inbox.activate();
inbox.approve(THING_UID, "Test");

View File

@ -13,7 +13,6 @@
package org.openhab.core.config.xml;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@ -64,7 +63,7 @@ public abstract class AbstractXmlBasedProvider<@NonNull T_ID, @NonNull T_OBJECT
* @param object the object to be added
*/
public final synchronized void add(Bundle bundle, T_OBJECT object) {
addAll(bundle, Collections.singletonList(object));
addAll(bundle, List.of(object));
}
/**

View File

@ -26,7 +26,6 @@ import java.time.ZonedDateTime;
import java.time.format.TextStyle;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
@ -141,7 +140,7 @@ public class EphemerisManagerImpl implements EphemerisManager, ConfigOptionProvi
}
String[] setDefinition = value.split(",");
if (setDefinition.length > 0) {
addDayset(setName, Arrays.asList(setDefinition));
addDayset(setName, List.of(setDefinition));
} else {
logger.warn("Erroneous dayset definition {} : {}", e.getKey(), entry);
}

View File

@ -12,7 +12,6 @@
*/
package org.openhab.core.io.console.rfc147.internal.extension;
import java.util.Collections;
import java.util.List;
import org.openhab.core.io.console.Console;
@ -52,6 +51,6 @@ public class HelpConsoleCommandExtension extends AbstractConsoleCommandExtension
@Override
public List<String> getUsages() {
return Collections.singletonList(buildCommandUsage(getDescription()));
return List.of(buildCommandUsage(getDescription()));
}
}

View File

@ -14,8 +14,8 @@ package org.openhab.core.io.console.internal.extension;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.function.Consumer;
import org.eclipse.jdt.annotation.NonNullByDefault;
@ -86,7 +86,7 @@ public class ItemConsoleCommandExtension extends AbstractConsoleCommandExtension
if (args.length > 1) {
Item item = itemRegistry.get(args[1]);
if (item != null) {
removeItems(console, Collections.singleton(item));
removeItems(console, Set.of(item));
} else {
console.println("0 item(s) removed.");
}

View File

@ -12,7 +12,6 @@
*/
package org.openhab.core.io.console.internal.extension;
import java.util.Collections;
import java.util.List;
import org.eclipse.jdt.annotation.NonNullByDefault;
@ -56,7 +55,7 @@ public class SendConsoleCommandExtension extends AbstractConsoleCommandExtension
@Override
public List<String> getUsages() {
return Collections.singletonList(buildCommandUsage("<item> <command>", "sends a command for an item"));
return List.of(buildCommandUsage("<item> <command>", "sends a command for an item"));
}
@Override

View File

@ -12,7 +12,6 @@
*/
package org.openhab.core.io.console.internal.extension;
import java.util.Collections;
import java.util.List;
import org.eclipse.jdt.annotation.NonNullByDefault;
@ -48,7 +47,7 @@ public class StatusConsoleCommandExtension extends AbstractConsoleCommandExtensi
@Override
public List<String> getUsages() {
return Collections.singletonList(buildCommandUsage("<item>", "shows the current status of an item"));
return List.of(buildCommandUsage("<item>", "shows the current status of an item"));
}
@Override

View File

@ -12,7 +12,6 @@
*/
package org.openhab.core.io.console.internal.extension;
import java.util.Collections;
import java.util.List;
import org.eclipse.jdt.annotation.NonNullByDefault;
@ -56,7 +55,7 @@ public class UpdateConsoleCommandExtension extends AbstractConsoleCommandExtensi
@Override
public List<String> getUsages() {
return Collections.singletonList(buildCommandUsage("<item> <state>", "sends a status update for an item"));
return List.of(buildCommandUsage("<item> <state>", "sends a status update for an item"));
}
@Override

View File

@ -12,7 +12,6 @@
*/
package org.openhab.core.io.monitor.internal;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@ -33,7 +32,7 @@ public class EventLogger implements EventSubscriber {
private final Map<String, Logger> eventLoggers = new HashMap<>();
private final Set<String> subscribedEventTypes = Collections.singleton(EventSubscriber.ALL_EVENT_TYPES);
private final Set<String> subscribedEventTypes = Set.of(EventSubscriber.ALL_EVENT_TYPES);
@Override
public Set<String> getSubscribedEventTypes() {

View File

@ -13,10 +13,9 @@
package org.openhab.core.io.rest.core.config;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import org.eclipse.jdt.annotation.NonNullByDefault;
@ -50,10 +49,10 @@ public class EnrichedConfigDescriptionParameterDTO extends ConfigDescriptionPara
if (multiple && defaultValue != null) {
if (defaultValue.contains(DEFAULT_LIST_DELIMITER)) {
defaultValues = Arrays.asList(defaultValue.split(DEFAULT_LIST_DELIMITER)).stream().map(v -> v.trim())
defaultValues = List.of(defaultValue.split(DEFAULT_LIST_DELIMITER)).stream().map(v -> v.trim())
.filter(v -> !v.isEmpty()).collect(Collectors.toList());
} else {
defaultValues = Collections.singleton(defaultValue);
defaultValues = Set.of(defaultValue);
}
}
}

View File

@ -15,6 +15,7 @@ package org.openhab.core.io.rest.core.internal.binding;
import java.io.IOException;
import java.net.URI;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
@ -192,7 +193,7 @@ public class BindingResource implements RESTResource {
return properties;
}
return ConfigUtil.normalizeTypes(properties, Collections.singletonList(configDesc));
return ConfigUtil.normalizeTypes(properties, List.of(configDesc));
}
private @Nullable String getConfigId(String bindingId) {

View File

@ -250,7 +250,7 @@ public class ConfigurableServiceResource implements RESTResource {
return properties;
}
return ConfigUtil.normalizeTypes(properties, Collections.singletonList(configDesc));
return ConfigUtil.normalizeTypes(properties, List.of(configDesc));
}
@DELETE

View File

@ -17,7 +17,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
import java.net.URI;
import java.util.Arrays;
import java.util.List;
import org.junit.jupiter.api.Test;
import org.openhab.core.config.core.ConfigDescription;
@ -89,6 +89,6 @@ public class EnrichedConfigDescriptionDTOMapperTest {
EnrichedConfigDescriptionParameterDTO ecdpdto = (EnrichedConfigDescriptionParameterDTO) cdpdto;
assertThat(ecdpdto.defaultValues, is(notNullValue()));
assertThat(ecdpdto.defaultValues, hasSize(3));
assertThat(ecdpdto.defaultValues, is(equalTo(Arrays.asList("first value", "second value", "third value"))));
assertThat(ecdpdto.defaultValues, is(equalTo(List.of("first value", "second value", "third value"))));
}
}

View File

@ -17,8 +17,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.*;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Set;
@ -74,10 +73,10 @@ public class ChannelTypeResourceTest {
when(channelTypeRegistry.getChannelType(uid)).thenReturn(channelType);
TriggerProfileType profileType = mock(TriggerProfileType.class);
when(profileType.getSupportedChannelTypeUIDs()).thenReturn(Collections.singletonList(uid));
when(profileType.getSupportedItemTypes()).thenReturn(Arrays.asList("Switch", "Dimmer"));
when(profileType.getSupportedChannelTypeUIDs()).thenReturn(List.of(uid));
when(profileType.getSupportedItemTypes()).thenReturn(List.of("Switch", "Dimmer"));
when(profileTypeRegistry.getProfileTypes()).thenReturn(Collections.singletonList(profileType));
when(profileTypeRegistry.getProfileTypes()).thenReturn(List.of(profileType));
Response response = channelTypeResource.getLinkableItemTypes(uid.getAsString());

View File

@ -13,7 +13,6 @@
package org.openhab.core.io.rest.sitemap;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@ -342,7 +341,7 @@ public class SitemapSubscriptionService implements ModelRepositoryChangeListener
@Override
public Set<String> getSubscribedEventTypes() {
return Collections.singleton(ItemStatePredictedEvent.TYPE);
return Set.of(ItemStatePredictedEvent.TYPE);
}
@Override

View File

@ -13,7 +13,6 @@
package org.openhab.core.io.rest.sitemap.internal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -58,7 +57,7 @@ public class JerseyResponseBuilderUtils extends DTO {
jrbDTO.status = "CREATED";
jrbDTO.context = new ContextDTO();
jrbDTO.context.headers = new HashMap<>();
jrbDTO.context.headers.put("Location", Arrays.asList(location));
jrbDTO.context.headers.put("Location", List.of(location));
jrbDTO.context.committingOutputStream = new StreamInfoDTO();
jrbDTO.context.committingOutputStream.bufferSize = 0;
jrbDTO.context.committingOutputStream.directWrite = true;

View File

@ -20,9 +20,9 @@ import static org.mockito.Mockito.*;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.HttpHeaders;
@ -163,7 +163,7 @@ public class SitemapResourceTest extends JavaTest {
}).start();
// non-null is sufficient here.
when(headers.getRequestHeader(HTTP_HEADER_X_ATMOSPHERE_TRANSPORT)).thenReturn(Collections.emptyList());
when(headers.getRequestHeader(HTTP_HEADER_X_ATMOSPHERE_TRANSPORT)).thenReturn(List.of());
Response response = sitemapResource.getPageData(headers, null, SITEMAP_MODEL_NAME, SITEMAP_NAME, null, false);
@ -184,7 +184,7 @@ public class SitemapResourceTest extends JavaTest {
}).start();
// non-null is sufficient here.
when(headers.getRequestHeader(HTTP_HEADER_X_ATMOSPHERE_TRANSPORT)).thenReturn(Collections.emptyList());
when(headers.getRequestHeader(HTTP_HEADER_X_ATMOSPHERE_TRANSPORT)).thenReturn(List.of());
Response response = sitemapResource.getPageData(headers, null, SITEMAP_MODEL_NAME, SITEMAP_NAME, null, false);
@ -205,7 +205,7 @@ public class SitemapResourceTest extends JavaTest {
}).start();
// non-null is sufficient here.
when(headers.getRequestHeader(HTTP_HEADER_X_ATMOSPHERE_TRANSPORT)).thenReturn(Collections.emptyList());
when(headers.getRequestHeader(HTTP_HEADER_X_ATMOSPHERE_TRANSPORT)).thenReturn(List.of());
Response response = sitemapResource.getPageData(headers, null, SITEMAP_MODEL_NAME, SITEMAP_NAME, null, false);
@ -226,7 +226,7 @@ public class SitemapResourceTest extends JavaTest {
}).start();
// non-null is sufficient here.
when(headers.getRequestHeader(HTTP_HEADER_X_ATMOSPHERE_TRANSPORT)).thenReturn(Collections.emptyList());
when(headers.getRequestHeader(HTTP_HEADER_X_ATMOSPHERE_TRANSPORT)).thenReturn(List.of());
Response response = sitemapResource.getPageData(headers, null, SITEMAP_MODEL_NAME, SITEMAP_NAME, null, false);
@ -358,7 +358,7 @@ public class SitemapResourceTest extends JavaTest {
}
private void configureSitemapProviderMock() {
when(sitemapProvider.getSitemapNames()).thenReturn(Collections.singleton(SITEMAP_MODEL_NAME));
when(sitemapProvider.getSitemapNames()).thenReturn(Set.of(SITEMAP_MODEL_NAME));
when(sitemapProvider.getSitemap(SITEMAP_MODEL_NAME)).thenReturn(defaultSitemap);
}
@ -370,12 +370,12 @@ public class SitemapResourceTest extends JavaTest {
@Override
public List<Class<? extends State>> getAcceptedDataTypes() {
return Collections.emptyList();
return List.of();
}
@Override
public List<Class<? extends Command>> getAcceptedCommandTypes() {
return Collections.emptyList();
return List.of();
}
}
}

View File

@ -12,7 +12,6 @@
*/
package org.openhab.core.io.rest.sse.internal.listeners;
import java.util.Collections;
import java.util.Set;
import org.eclipse.jdt.annotation.NonNullByDefault;
@ -36,7 +35,7 @@ import org.osgi.service.component.annotations.Reference;
@NonNullByDefault
public class SseEventSubscriber implements EventSubscriber {
private final Set<String> subscribedEventTypes = Collections.singleton(EventSubscriber.ALL_EVENT_TYPES);
private final Set<String> subscribedEventTypes = Set.of(EventSubscriber.ALL_EVENT_TYPES);
private final SsePublisher ssePublisher;

View File

@ -13,7 +13,6 @@
package org.openhab.core.io.rest.internal.filter;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ -71,8 +70,8 @@ public class CorsFilter implements ContainerResponseFilter {
static final String VARY_HEADER_WILDCARD = "*";
static final String HEADERS_SEPARATOR = ",";
static final List<String> ACCEPTED_HTTP_METHODS_LIST = Arrays.asList(HTTP_GET_METHOD, HTTP_POST_METHOD,
HTTP_PUT_METHOD, HTTP_DELETE_METHOD, HTTP_HEAD_METHOD, HTTP_OPTIONS_METHOD);
static final List<String> ACCEPTED_HTTP_METHODS_LIST = List.of(HTTP_GET_METHOD, HTTP_POST_METHOD, HTTP_PUT_METHOD,
HTTP_DELETE_METHOD, HTTP_HEAD_METHOD, HTTP_OPTIONS_METHOD);
static final String ACCEPTED_HTTP_METHODS = ACCEPTED_HTTP_METHODS_LIST.stream()
.collect(Collectors.joining(HEADERS_SEPARATOR));

View File

@ -19,7 +19,6 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Stream;
@ -56,7 +55,7 @@ public class Stream2JSONInputStreamTest {
@Test
public void shouldStreamSingleObjectToJSON() throws Exception {
DummyObject dummyObject = new DummyObject("demoKey", "demoValue");
List<DummyObject> dummyList = Arrays.asList(dummyObject);
List<DummyObject> dummyList = List.of(dummyObject);
collection2InputStream = new Stream2JSONInputStream(Stream.of(dummyObject));
assertThat(inputStreamToString(collection2InputStream), is(GSON.toJson(dummyList)));
@ -66,7 +65,7 @@ public class Stream2JSONInputStreamTest {
public void shouldStreamCollectionStreamToJSON() throws Exception {
DummyObject dummyObject1 = new DummyObject("demoKey1", "demoValue1");
DummyObject dummyObject2 = new DummyObject("demoKey2", "demoValue2");
List<DummyObject> dummyCollection = Arrays.asList(dummyObject1, dummyObject2);
List<DummyObject> dummyCollection = List.of(dummyObject1, dummyObject2);
collection2InputStream = new Stream2JSONInputStream(dummyCollection.stream());
assertThat(inputStreamToString(collection2InputStream), is(GSON.toJson(dummyCollection)));

View File

@ -12,13 +12,14 @@
*/
package org.openhab.core.io.rest.internal.filter;
import static java.util.Collections.*;
import static java.util.stream.Collectors.toList;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.when;
import static org.openhab.core.io.rest.internal.filter.CorsFilter.*;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.stream.Stream;
import javax.ws.rs.container.ContainerRequestContext;
@ -62,7 +63,7 @@ public class CorsFilterTest {
@BeforeEach
public void setUp() {
filter = new CorsFilter();
filter.activate(singletonMap("enable", "true"));
filter.activate(Map.of("enable", "true"));
}
@Test
@ -163,13 +164,13 @@ public class CorsFilterTest {
String requestHeadersValue) {
MultivaluedMap<String, String> headers = new MultivaluedHashMap<>();
if (originValue != null) {
headers.put(ORIGIN_HEADER, singletonList(originValue));
headers.put(ORIGIN_HEADER, List.of(originValue));
}
if (requestMethodValue != null) {
headers.put(ACCESS_CONTROL_REQUEST_METHOD, singletonList(requestMethodValue));
headers.put(ACCESS_CONTROL_REQUEST_METHOD, List.of(requestMethodValue));
}
if (requestHeadersValue != null) {
headers.put(ACCESS_CONTROL_REQUEST_HEADERS, singletonList(requestHeadersValue));
headers.put(ACCESS_CONTROL_REQUEST_HEADERS, List.of(requestHeadersValue));
}
when(requestContext.getHeaders()).thenReturn(headers);

View File

@ -18,7 +18,7 @@ import static org.openhab.core.io.rest.internal.filter.ProxyFilter.*;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Collections;
import java.util.List;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.core.MultivaluedHashMap;
@ -169,10 +169,10 @@ public class ProxyFilterTest {
private void setupContextHeaders(String protoHeader, String hostHeader) {
MultivaluedMap<String, String> headers = new MultivaluedHashMap<>();
if (protoHeader != null) {
headers.put(PROTO_PROXY_HEADER, Collections.singletonList(protoHeader));
headers.put(PROTO_PROXY_HEADER, List.of(protoHeader));
}
if (hostHeader != null) {
headers.put(HOST_PROXY_HEADER, Collections.singletonList(hostHeader));
headers.put(HOST_PROXY_HEADER, List.of(hostHeader));
}
when(context.getHeaders()).thenReturn(headers);
}

View File

@ -273,7 +273,7 @@ public class FeatureInstaller implements ConfigurationListener {
Object repos = properties.get(PROPERTY_MVN_REPOS);
List<String> repoCfg;
if (repos instanceof String) {
repoCfg = Arrays.asList(((String) repos).split(","));
repoCfg = List.of(((String) repos).split(","));
return repoCfg.contains(onlineRepoUrl);
}
} catch (IOException e) {

View File

@ -14,7 +14,6 @@ package org.openhab.core.karaf.internal;
import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedList;
@ -70,7 +69,7 @@ public class KarafAddonService implements AddonService {
try {
for (Feature feature : featuresService.listFeatures()) {
if (feature.getName().startsWith(FeatureInstaller.PREFIX)
&& Arrays.asList(FeatureInstaller.EXTENSION_TYPES).contains(getType(feature.getName()))) {
&& List.of(FeatureInstaller.EXTENSION_TYPES).contains(getType(feature.getName()))) {
Addon addon = getAddon(feature);
// for simple packaging, we filter out all openHAB 1 add-ons as they cannot be used through the UI
if (!FeatureInstaller.SIMPLE_PACKAGE.equals(featureInstaller.getCurrentPackage())

View File

@ -18,7 +18,6 @@ import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
@ -59,7 +58,7 @@ public class ModelRepositoryImpl implements ModelRepository {
private final Logger logger = LoggerFactory.getLogger(ModelRepositoryImpl.class);
private final ResourceSet resourceSet;
private final Map<String, String> resourceOptions = Collections.singletonMap(XtextResource.OPTION_ENCODING,
private final Map<String, String> resourceOptions = Map.of(XtextResource.OPTION_ENCODING,
StandardCharsets.UTF_8.name());
private final List<ModelRepositoryChangeListener> listeners = new CopyOnWriteArrayList<>();

View File

@ -16,8 +16,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import org.eclipse.emf.common.util.URI;
import org.junit.jupiter.api.BeforeEach;
@ -35,7 +35,7 @@ public class MappingUriExtensionsTest {
private File confFolder;
private static Collection<Object[]> data() {
return Arrays.asList(new Object[][] { //
return List.of(new Object[][] { //
{ "conf", //
"file:///q:/conf", //
"file:///q:/conf", //

View File

@ -14,7 +14,6 @@ package org.openhab.core.model.rule.runtime.internal;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@ -257,8 +256,8 @@ public class DSLRuleProvider
Configuration cfg = new Configuration();
cfg.put("script", context + removeIndentation(script));
cfg.put("type", MIMETYPE_OPENHAB_DSL_RULE);
List<Action> actions = Collections.singletonList(ActionBuilder.create().withId("script")
.withTypeUID("script.ScriptAction").withConfiguration(cfg).build());
List<Action> actions = List.of(ActionBuilder.create().withId("script").withTypeUID("script.ScriptAction")
.withConfiguration(cfg).build());
return RuleBuilder.create(uid).withName(name).withTriggers(triggers).withActions(actions).build();
}

View File

@ -13,7 +13,6 @@
package org.openhab.core.model.script.runtime.internal.engine;
import java.io.Reader;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@ -210,7 +209,7 @@ public class DSLScriptEngine implements javax.script.ScriptEngine {
@Override
public List<String> getMimeTypes() {
return Collections.singletonList(MIMETYPE_OPENHAB_DSL_RULE);
return List.of(MIMETYPE_OPENHAB_DSL_RULE);
}
@Override

View File

@ -13,7 +13,6 @@
package org.openhab.core.model.script.extension;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
@ -68,7 +67,7 @@ public class ScriptEngineConsoleCommandExtension extends AbstractConsoleCommandE
@Override
public List<String> getUsages() {
return Collections.singletonList(buildCommandUsage("<script to execute>", "Executes a script"));
return List.of(buildCommandUsage("<script to execute>", "Executes a script"));
}
@Reference(policy = ReferencePolicy.DYNAMIC)

View File

@ -420,8 +420,8 @@ public class PersistenceManagerImpl implements ItemRegistryChangeListener, Persi
private @Nullable PersistenceServiceConfiguration getDefaultConfig(PersistenceService persistenceService) {
List<PersistenceStrategy> strategies = persistenceService.getDefaultStrategies();
List<PersistenceItemConfiguration> configs = Collections.singletonList(new PersistenceItemConfiguration(
Collections.singletonList(new PersistenceAllConfig()), null, strategies, null));
List<PersistenceItemConfiguration> configs = List
.of(new PersistenceItemConfiguration(List.of(new PersistenceAllConfig()), null, strategies, null));
return new PersistenceServiceConfiguration(configs, strategies, strategies);
}

View File

@ -12,8 +12,6 @@
*/
package org.openhab.core.semantics;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@ -87,9 +85,9 @@ public class SemanticTags {
Control.getNoFallbackControl(Control.FORMAT_PROPERTIES));
try {
String entry = rb.getString(tag.getAnnotation(TagInfo.class).id());
return Arrays.asList(entry.toLowerCase(locale).split(","));
return List.of(entry.toLowerCase(locale).split(","));
} catch (MissingResourceException e) {
return Collections.singletonList(tag.getAnnotation(TagInfo.class).label());
return List.of(tag.getAnnotation(TagInfo.class).label());
}
}

View File

@ -12,7 +12,6 @@
*/
package org.openhab.core.semantics.internal;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
@ -220,15 +219,15 @@ public class SemanticsMetadataProvider extends AbstractProvider<Metadata>
}
private void initRelations() {
parentRelations.put(Arrays.asList(Equipment.class, Location.class), "hasLocation");
parentRelations.put(Arrays.asList(Point.class, Location.class), "hasLocation");
parentRelations.put(Arrays.asList(Location.class, Location.class), "isPartOf");
parentRelations.put(Arrays.asList(Equipment.class, Equipment.class), "isPartOf");
parentRelations.put(Arrays.asList(Point.class, Equipment.class), "isPointOf");
parentRelations.put(List.of(Equipment.class, Location.class), "hasLocation");
parentRelations.put(List.of(Point.class, Location.class), "hasLocation");
parentRelations.put(List.of(Location.class, Location.class), "isPartOf");
parentRelations.put(List.of(Equipment.class, Equipment.class), "isPartOf");
parentRelations.put(List.of(Point.class, Equipment.class), "isPointOf");
memberRelations.put(Arrays.asList(Equipment.class, Point.class), "hasPoint");
memberRelations.put(List.of(Equipment.class, Point.class), "hasPoint");
propertyRelations.put(Arrays.asList(Point.class), "relatesTo");
propertyRelations.put(List.of(Point.class), "relatesTo");
}
@Override

View File

@ -19,7 +19,6 @@ import java.io.IOException;
import java.math.BigDecimal;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.jupiter.api.BeforeEach;
@ -144,7 +143,7 @@ public class JsonStorageTest extends JavaTest {
configuration.put("testBigDecimal", new BigDecimal(12));
configuration.put("testBoolean", true);
configuration.put("testString", "hello world");
configuration.put("multiInt", Arrays.asList(1, 2, 3));
configuration.put("multiInt", List.of(1, 2, 3));
InnerObject inner = new InnerObject();
inner.configuration.put("testChildLong", Long.valueOf("12"));

View File

@ -13,7 +13,7 @@
package org.openhab.core.magic.binding.handler;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.magic.binding.internal.automation.modules.MagicThingActionsService;
@ -57,6 +57,6 @@ public class MagicActionModuleThingHandler extends BaseThingHandler {
@Override
public Collection<Class<? extends ThingHandlerService>> getServices() {
return Collections.singletonList(MagicThingActionsService.class);
return List.of(MagicThingActionsService.class);
}
}

View File

@ -18,8 +18,6 @@ import java.util.List;
import java.util.Set;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
@ -49,8 +47,8 @@ public class MagicChattyThingHandler extends BaseThingHandler {
private static final String PARAM_INTERVAL = "interval";
private static final int START_DELAY = 3;
private static final List<String> RANDOM_TEXTS = Stream
.of("OPEN", "CLOSED", "ON", "OFF", "Hello", "This is a sentence").collect(Collectors.toList());
private static final List<String> RANDOM_TEXTS = List.of("OPEN", "CLOSED", "ON", "OFF", "Hello",
"This is a sentence");
private final Set<ChannelUID> numberChannelUIDs = new HashSet<>();
private final Set<ChannelUID> textChannelUIDs = new HashSet<>();

View File

@ -14,7 +14,7 @@ package org.openhab.core.magic.binding.handler;
import static org.openhab.core.magic.binding.MagicBindingConstants.*;
import java.util.Arrays;
import java.util.List;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.magic.binding.internal.MagicDynamicStateDescriptionProvider;
@ -51,15 +51,15 @@ public class MagicDynamicStateDescriptionThingHandler extends BaseThingHandler {
public void initialize() {
ChannelUID systemCommandChannelUID = new ChannelUID(getThing().getUID(), CHANNEL_SYSTEM_COMMAND);
stateDescriptionProvider.setStateOptions(systemCommandChannelUID,
Arrays.asList(new StateOption(SYSTEM_COMMAND_HIBERNATE, SYSTEM_COMMAND_HIBERNATE),
List.of(new StateOption(SYSTEM_COMMAND_HIBERNATE, SYSTEM_COMMAND_HIBERNATE),
new StateOption(SYSTEM_COMMAND_REBOOT, SYSTEM_COMMAND_REBOOT),
new StateOption(SYSTEM_COMMAND_SHUTDOWN, SYSTEM_COMMAND_SHUTDOWN),
new StateOption(SYSTEM_COMMAND_SUSPEND, SYSTEM_COMMAND_SUSPEND),
new StateOption(SYSTEM_COMMAND_QUIT, SYSTEM_COMMAND_QUIT)));
ChannelUID signalStrengthChannelUID = new ChannelUID(getThing().getUID(), CHANNEL_SIGNAL_STRENGTH);
stateDescriptionProvider.setStateOptions(signalStrengthChannelUID, Arrays.asList(
new StateOption("1", "Unusable"), new StateOption("2", "Okay"), new StateOption("3", "Amazing")));
stateDescriptionProvider.setStateOptions(signalStrengthChannelUID, List.of(new StateOption("1", "Unusable"),
new StateOption("2", "Okay"), new StateOption("3", "Amazing")));
updateStatus(ThingStatus.ONLINE);
}

View File

@ -14,7 +14,7 @@ package org.openhab.core.magic.binding.internal;
import static org.openhab.core.magic.binding.MagicBindingConstants.THING_TYPE_CONFIG_THING;
import java.util.Collections;
import java.util.Set;
import java.util.UUID;
import org.eclipse.jdt.annotation.NonNullByDefault;
@ -36,7 +36,7 @@ import org.osgi.service.component.annotations.Component;
public class MagicDiscoveryService extends AbstractDiscoveryService {
public MagicDiscoveryService() throws IllegalArgumentException {
super(Collections.singleton(THING_TYPE_CONFIG_THING), 0);
super(Set.of(THING_TYPE_CONFIG_THING), 0);
}
@Override

View File

@ -14,10 +14,7 @@ package org.openhab.core.magic.binding.internal;
import static org.openhab.core.magic.binding.MagicBindingConstants.*;
import java.util.Collections;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
@ -59,13 +56,12 @@ import org.osgi.service.component.annotations.Reference;
@NonNullByDefault
public class MagicHandlerFactory extends BaseThingHandlerFactory {
private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections
.unmodifiableSet(Stream.of(THING_TYPE_EXTENSIBLE_THING, THING_TYPE_ON_OFF_LIGHT, THING_TYPE_DIMMABLE_LIGHT,
THING_TYPE_COLOR_LIGHT, THING_TYPE_CONTACT_SENSOR, THING_TYPE_CONFIG_THING,
THING_TYPE_DELAYED_THING, THING_TYPE_LOCATION, THING_TYPE_THERMOSTAT, THING_TYPE_FIRMWARE_UPDATE,
THING_TYPE_BRIDGE_1, THING_TYPE_BRIDGE_2, THING_TYPE_BRIDGED_THING, THING_TYPE_CHATTY_THING,
THING_TYPE_ROLLERSHUTTER, THING_TYPE_PLAYER, THING_TYPE_IMAGE, THING_TYPE_ACTION_MODULE,
THING_TYPE_DYNAMIC_STATE_DESCRIPTION, THING_TYPE_ONLINE_OFFLINE).collect(Collectors.toSet()));
private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Set.of(THING_TYPE_EXTENSIBLE_THING,
THING_TYPE_ON_OFF_LIGHT, THING_TYPE_DIMMABLE_LIGHT, THING_TYPE_COLOR_LIGHT, THING_TYPE_CONTACT_SENSOR,
THING_TYPE_CONFIG_THING, THING_TYPE_DELAYED_THING, THING_TYPE_LOCATION, THING_TYPE_THERMOSTAT,
THING_TYPE_FIRMWARE_UPDATE, THING_TYPE_BRIDGE_1, THING_TYPE_BRIDGE_2, THING_TYPE_BRIDGED_THING,
THING_TYPE_CHATTY_THING, THING_TYPE_ROLLERSHUTTER, THING_TYPE_PLAYER, THING_TYPE_IMAGE,
THING_TYPE_ACTION_MODULE, THING_TYPE_DYNAMIC_STATE_DESCRIPTION, THING_TYPE_ONLINE_OFFLINE);
private final MagicDynamicStateDescriptionProvider stateDescriptionProvider;

View File

@ -14,8 +14,8 @@ package org.openhab.core.magic.binding.internal;
import java.math.BigDecimal;
import java.net.URI;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@ -56,7 +56,7 @@ public class MagicServiceImpl implements MagicService {
}
if (PARAMETER_BACKEND_DECIMAL.equals(param)) {
return Arrays.asList(new ParameterOption(BigDecimal.ONE.toPlainString(), "1"),
return List.of(new ParameterOption(BigDecimal.ONE.toPlainString(), "1"),
new ParameterOption(BigDecimal.TEN.toPlainString(), "10"),
new ParameterOption(BigDecimal.valueOf(21d).toPlainString(), "21"));
}

View File

@ -31,8 +31,6 @@ import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.jar.JarOutputStream;
import java.util.jar.Manifest;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.zip.ZipEntry;
import org.openhab.core.service.ReadyMarker;
@ -72,8 +70,7 @@ public class SyntheticBundleInstaller {
/**
* A list of default extensions to be included in the synthetic bundle.
*/
private static final Set<String> DEFAULT_EXTENSIONS = Collections
.unmodifiableSet(Stream.of("*.xml", "*.properties", "*.json", ".keep").collect(Collectors.toSet()));
private static final Set<String> DEFAULT_EXTENSIONS = Set.of("*.xml", "*.properties", "*.json", ".keep");
/**
* Install synthetic bundle, denoted by its name, into the test runtime (by using the given bundle context). Only

View File

@ -12,8 +12,6 @@
*/
package org.openhab.core.thing;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Map;
@ -70,7 +68,7 @@ public class Channel {
Channel() {
this.kind = ChannelKind.STATE;
this.configuration = new Configuration();
this.properties = Collections.unmodifiableMap(new HashMap<>(0));
this.properties = Map.of();
}
/**
@ -82,7 +80,7 @@ public class Channel {
this.acceptedItemType = acceptedItemType;
this.kind = ChannelKind.STATE;
this.configuration = new Configuration();
this.properties = Collections.unmodifiableMap(new HashMap<>(0));
this.properties = Map.of();
}
/**
@ -125,17 +123,9 @@ public class Channel {
this.label = label;
this.description = description;
this.autoUpdatePolicy = autoUpdatePolicy;
this.defaultTags = Collections.<String> unmodifiableSet(new HashSet<>(defaultTags));
if (configuration == null) {
this.configuration = new Configuration();
} else {
this.configuration = configuration;
}
if (properties == null) {
this.properties = Collections.unmodifiableMap(new HashMap<>(0));
} else {
this.properties = properties;
}
this.defaultTags = Set.copyOf(defaultTags);
this.configuration = configuration == null ? new Configuration() : configuration;
this.properties = properties == null ? Map.of() : properties;
}
/**
@ -211,7 +201,7 @@ public class Channel {
*/
public Map<String, String> getProperties() {
synchronized (this) {
return Collections.unmodifiableMap(new HashMap<>(properties));
return Map.copyOf(properties);
}
}

View File

@ -16,13 +16,10 @@ import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
@ -280,13 +277,12 @@ public class DefaultSystemChannelTypeProvider implements ChannelTypeProvider {
StateDescriptionFragmentBuilder.create().withReadOnly(true).withPattern("%.3f %unit%").build())
.build();
private static final Collection<ChannelType> CHANNEL_TYPES = Collections
.unmodifiableList(Stream.of(SYSTEM_CHANNEL_SIGNAL_STRENGTH, SYSTEM_CHANNEL_LOW_BATTERY,
SYSTEM_CHANNEL_BATTERY_LEVEL, SYSTEM_TRIGGER, SYSTEM_RAWBUTTON, SYSTEM_BUTTON, SYSTEM_RAWROCKER,
SYSTEM_POWER, SYSTEM_LOCATION, SYSTEM_MOTION, SYSTEM_BRIGHTNESS, SYSTEM_COLOR,
SYSTEM_COLOR_TEMPERATURE, SYSTEM_VOLUME, SYSTEM_MUTE, SYSTEM_MEDIA_CONTROL, SYSTEM_MEDIA_TITLE,
SYSTEM_MEDIA_ARTIST, SYSTEM_WIND_DIRECTION, SYSTEM_WIND_SPEED, SYSTEM_OUTDOOR_TEMPERATURE,
SYSTEM_ATMOSPHERIC_HUMIDITY, SYSTEM_BAROMETRIC_PRESSURE).collect(Collectors.toList()));
private static final Collection<ChannelType> CHANNEL_TYPES = List.of(SYSTEM_CHANNEL_SIGNAL_STRENGTH,
SYSTEM_CHANNEL_LOW_BATTERY, SYSTEM_CHANNEL_BATTERY_LEVEL, SYSTEM_TRIGGER, SYSTEM_RAWBUTTON, SYSTEM_BUTTON,
SYSTEM_RAWROCKER, SYSTEM_POWER, SYSTEM_LOCATION, SYSTEM_MOTION, SYSTEM_BRIGHTNESS, SYSTEM_COLOR,
SYSTEM_COLOR_TEMPERATURE, SYSTEM_VOLUME, SYSTEM_MUTE, SYSTEM_MEDIA_CONTROL, SYSTEM_MEDIA_TITLE,
SYSTEM_MEDIA_ARTIST, SYSTEM_WIND_DIRECTION, SYSTEM_WIND_SPEED, SYSTEM_OUTDOOR_TEMPERATURE,
SYSTEM_ATMOSPHERIC_HUMIDITY, SYSTEM_BAROMETRIC_PRESSURE);
private final Map<LocalizedKey, @Nullable ChannelType> localizedChannelTypeCache = new ConcurrentHashMap<>();

View File

@ -12,7 +12,6 @@
*/
package org.openhab.core.thing.binding;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
@ -510,7 +509,7 @@ public abstract class BaseThingHandler implements ThingHandler {
* @param value the value of the property
*/
protected void updateProperty(String name, String value) {
updateProperties(Collections.singletonMap(name, value));
updateProperties(Map.of(name, value));
}
/**

View File

@ -14,7 +14,6 @@ package org.openhab.core.thing.binding.builder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@ -72,7 +71,7 @@ public class ThingBuilder {
}
public ThingBuilder withChannel(Channel channel) {
validateChannelUIDs(Collections.singletonList(channel));
validateChannelUIDs(List.of(channel));
ThingHelper.ensureUniqueChannels(channels, channel);
channels.add(channel);
return this;

View File

@ -12,9 +12,6 @@
*/
package org.openhab.core.thing.internal;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@ -94,8 +91,8 @@ public class CommunicationManager implements EventSubscriber, RegistryChangeList
// the timeout to use for any item event processing
public static final long THINGHANDLER_EVENT_TIMEOUT = TimeUnit.SECONDS.toMillis(30);
private static final Set<String> SUBSCRIBED_EVENT_TYPES = Collections.unmodifiableSet(
new HashSet<>(Arrays.asList(ItemStateEvent.TYPE, ItemCommandEvent.TYPE, ChannelTriggeredEvent.TYPE)));
private static final Set<String> SUBSCRIBED_EVENT_TYPES = Set.of(ItemStateEvent.TYPE, ItemCommandEvent.TYPE,
ChannelTriggeredEvent.TYPE);
private final Logger logger = LoggerFactory.getLogger(CommunicationManager.class);

View File

@ -163,7 +163,7 @@ public class ThingConsoleCommandExtension extends AbstractConsoleCommandExtensio
@Override
public List<String> getUsages() {
return Arrays.asList(new String[] { buildCommandUsage(SUBCMD_LIST, "lists all things"),
return List.of(buildCommandUsage(SUBCMD_LIST, "lists all things"),
buildCommandUsage(SUBCMD_SHOW + " <thingUID>*",
"show details about one or more things; show details for all things if no thingUID provided"),
buildCommandUsage(SUBCMD_CLEAR, "removes all managed things"),
@ -171,7 +171,7 @@ public class ThingConsoleCommandExtension extends AbstractConsoleCommandExtensio
buildCommandUsage(SUBCMD_TRIGGER + " <channelUID> [<event>]",
"triggers the <channelUID> with <event> (if given)"),
buildCommandUsage(SUBCMD_DISABLE + " <thingUID>", "disables a thing"),
buildCommandUsage(SUBCMD_ENABLE + " <thingUID>", "enables a thing") });
buildCommandUsage(SUBCMD_ENABLE + " <thingUID>", "enables a thing"));
}
private void printThings(Console console, Collection<Thing> things) {

View File

@ -17,7 +17,6 @@ import static org.openhab.core.thing.firmware.FirmwareStatusInfo.*;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@ -28,8 +27,6 @@ import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
@ -77,9 +74,8 @@ import org.slf4j.LoggerFactory;
@NonNullByDefault
public final class FirmwareUpdateServiceImpl implements FirmwareUpdateService, EventSubscriber {
private static final String THREAD_POOL_NAME = FirmwareUpdateServiceImpl.class.getSimpleName();
private static final Set<String> SUPPORTED_TIME_UNITS = Collections.unmodifiableSet(
Stream.of(TimeUnit.SECONDS.name(), TimeUnit.MINUTES.name(), TimeUnit.HOURS.name(), TimeUnit.DAYS.name())
.collect(Collectors.toSet()));
private static final Set<String> SUPPORTED_TIME_UNITS = Set.of(TimeUnit.SECONDS.name(), TimeUnit.MINUTES.name(),
TimeUnit.HOURS.name(), TimeUnit.DAYS.name());
protected static final String PERIOD_CONFIG_KEY = "period";
protected static final String DELAY_CONFIG_KEY = "delay";
protected static final String TIME_UNIT_CONFIG_KEY = "timeUnit";
@ -95,7 +91,7 @@ public final class FirmwareUpdateServiceImpl implements FirmwareUpdateService, E
protected int timeout = 30 * 60 * 1000;
private final Set<String> subscribedEventTypes = Collections.singleton(ThingStatusInfoChangedEvent.TYPE);
private final Set<String> subscribedEventTypes = Set.of(ThingStatusInfoChangedEvent.TYPE);
private final Map<ThingUID, FirmwareStatusInfo> firmwareStatusInfoMap = new ConcurrentHashMap<>();
private final Map<ThingUID, ProgressCallbackImpl> progressCallbackMap = new ConcurrentHashMap<>();
@ -430,9 +426,9 @@ public final class FirmwareUpdateServiceImpl implements FirmwareUpdateService, E
private boolean isValid(Map<String, Object> config) {
// the config description validator does not support option value validation at the moment; so we will validate
// the time unit here
if (!SUPPORTED_TIME_UNITS.contains(config.get(TIME_UNIT_CONFIG_KEY))) {
logger.debug("Given time unit {} is not supported. Will keep current configuration.",
config.get(TIME_UNIT_CONFIG_KEY));
Object timeUnit = config.get(TIME_UNIT_CONFIG_KEY);
if (timeUnit == null || !SUPPORTED_TIME_UNITS.contains(timeUnit)) {
logger.debug("Given time unit {} is not supported. Will keep current configuration.", timeUnit);
return false;
}

View File

@ -21,7 +21,6 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
@ -64,20 +63,16 @@ public class SystemProfileFactory implements ProfileFactory, ProfileAdvisor, Pro
private final ChannelTypeRegistry channelTypeRegistry;
private static final Set<ProfileType> SUPPORTED_PROFILE_TYPES = Collections
.unmodifiableSet(Stream
.of(DEFAULT_TYPE, FOLLOW_TYPE, OFFSET_TYPE, RAWBUTTON_ON_OFF_SWITCH_TYPE,
RAWBUTTON_TOGGLE_PLAYER_TYPE, RAWBUTTON_TOGGLE_PLAYER_TYPE, RAWBUTTON_TOGGLE_SWITCH_TYPE,
RAWROCKER_DIMMER_TYPE, RAWROCKER_NEXT_PREVIOUS_TYPE, RAWROCKER_ON_OFF_TYPE,
RAWROCKER_PLAY_PAUSE_TYPE, RAWROCKER_REWIND_FASTFORWARD_TYPE, RAWROCKER_STOP_MOVE_TYPE,
RAWROCKER_UP_DOWN_TYPE, TIMESTAMP_CHANGE_TYPE, TIMESTAMP_UPDATE_TYPE)
.collect(Collectors.toSet()));
private static final Set<ProfileType> SUPPORTED_PROFILE_TYPES = Set.of(DEFAULT_TYPE, FOLLOW_TYPE, OFFSET_TYPE,
RAWBUTTON_ON_OFF_SWITCH_TYPE, RAWBUTTON_TOGGLE_PLAYER_TYPE, RAWBUTTON_TOGGLE_SWITCH_TYPE,
RAWROCKER_DIMMER_TYPE, RAWROCKER_NEXT_PREVIOUS_TYPE, RAWROCKER_ON_OFF_TYPE, RAWROCKER_PLAY_PAUSE_TYPE,
RAWROCKER_REWIND_FASTFORWARD_TYPE, RAWROCKER_STOP_MOVE_TYPE, RAWROCKER_UP_DOWN_TYPE, TIMESTAMP_CHANGE_TYPE,
TIMESTAMP_UPDATE_TYPE);
private static final Set<ProfileTypeUID> SUPPORTED_PROFILE_TYPE_UIDS = Collections
.unmodifiableSet(Stream.of(DEFAULT, FOLLOW, OFFSET, RAWBUTTON_ON_OFF_SWITCH, RAWBUTTON_TOGGLE_PLAYER,
RAWBUTTON_TOGGLE_PLAYER, RAWBUTTON_TOGGLE_SWITCH, RAWROCKER_DIMMER, RAWROCKER_NEXT_PREVIOUS,
RAWROCKER_ON_OFF, RAWROCKER_PLAY_PAUSE, RAWROCKER_REWIND_FASTFORWARD, RAWROCKER_STOP_MOVE,
RAWROCKER_UP_DOWN, TIMESTAMP_CHANGE, TIMESTAMP_UPDATE).collect(Collectors.toSet()));
private static final Set<ProfileTypeUID> SUPPORTED_PROFILE_TYPE_UIDS = Set.of(DEFAULT, FOLLOW, OFFSET,
RAWBUTTON_ON_OFF_SWITCH, RAWBUTTON_TOGGLE_PLAYER, RAWBUTTON_TOGGLE_SWITCH, RAWROCKER_DIMMER,
RAWROCKER_NEXT_PREVIOUS, RAWROCKER_ON_OFF, RAWROCKER_PLAY_PAUSE, RAWROCKER_REWIND_FASTFORWARD,
RAWROCKER_STOP_MOVE, RAWROCKER_UP_DOWN, TIMESTAMP_CHANGE, TIMESTAMP_UPDATE);
private final Map<LocalizedKey, ProfileType> localizedProfileTypeCache = new ConcurrentHashMap<>();

View File

@ -13,8 +13,6 @@
package org.openhab.core.thing.type;
import java.net.URI;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import org.openhab.core.config.core.ConfigDescription;
@ -146,9 +144,9 @@ public class ChannelType extends AbstractDescriptionType {
this.configDescriptionURI = configDescriptionURI;
if (tags != null) {
this.tags = Collections.unmodifiableSet(new HashSet<>(tags));
this.tags = Set.copyOf(tags);
} else {
this.tags = Collections.unmodifiableSet(new HashSet<>(0));
this.tags = Set.of();
}
this.advanced = advanced;

View File

@ -150,7 +150,7 @@ public class ThingHelper {
* @throws IllegalArgumentException in case there are duplicate channels found
*/
public static void ensureUniqueChannels(final Collection<Channel> channels, final Channel channel) {
ensureUniqueChannels(channels, Collections.singleton(channel));
ensureUniqueChannels(channels, Set.of(channel));
}
private static void ensureUniqueChannels(final Collection<Channel> channels1, final Collection<Channel> channels2) {
@ -158,7 +158,7 @@ public class ThingHelper {
ensureUniqueChannels(channels2.iterator(), new HashSet<>(channels1.size() + channels2.size())));
}
private static HashSet<UID> ensureUniqueChannels(final Iterator<Channel> channels, final HashSet<UID> ids) {
private static Set<UID> ensureUniqueChannels(final Iterator<Channel> channels, final Set<UID> ids) {
while (channels.hasNext()) {
final Channel channel = channels.next();
if (!ids.add(channel.getUID())) {

View File

@ -17,9 +17,8 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.jupiter.api.BeforeEach;
@ -43,13 +42,7 @@ public class ThingBuilderTest {
private static final String KEY2 = "key2";
private static final String VALUE1 = "value1";
private static final String VALUE2 = "value2";
private final Map<String, String> properties = new HashMap<String, String>() {
private static final long serialVersionUID = 1L;
{
put(KEY1, VALUE1);
put(KEY2, VALUE2);
}
};
private final Map<String, String> properties = Map.of(KEY1, VALUE1, KEY2, VALUE2);
private ThingBuilder thingBuilder;
@BeforeEach
@ -78,7 +71,7 @@ public class ThingBuilderTest {
@Test
public void testWithChannelsDuplicatesCollections() {
assertThrows(IllegalArgumentException.class, () -> thingBuilder.withChannels(Arrays.asList( //
assertThrows(IllegalArgumentException.class, () -> thingBuilder.withChannels(List.of( //
ChannelBuilder.create(new ChannelUID(THING_UID, "channel1")).build(), //
ChannelBuilder.create(new ChannelUID(THING_UID, "channel1")).build())));
}

View File

@ -16,7 +16,6 @@ import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
@ -42,15 +41,15 @@ public class ChannelDTOTest {
private static final ThingUID THING_UID = new ThingUID(THING_TYPE_UID, "thing-id");
private static final ChannelTypeUID CHANNEL_TYPE_UID = new ChannelTypeUID("binding-id", "channel-type-id");
private static final ChannelUID CHANNEL_UID = new ChannelUID(THING_UID, "channel1");
private final Map<String, String> properties = Collections.singletonMap("key1", "value1");
private final Set<String> tags = Collections.singleton("tag1");
private final Map<String, String> properties = Map.of("key1", "value1");
private final Set<String> tags = Set.of("tag1");
@Test
public void testChannelDTOMappingIsBidirectional() {
Channel subject = ChannelBuilder.create(CHANNEL_UID, CoreItemFactory.STRING).withType(CHANNEL_TYPE_UID)
.withLabel("Test").withDescription("My test channel")
.withConfiguration(new Configuration(Collections.singletonMap("param1", "value1")))
.withProperties(properties).withDefaultTags(tags).withAutoUpdatePolicy(AutoUpdatePolicy.VETO).build();
.withConfiguration(new Configuration(Map.of("param1", "value1"))).withProperties(properties)
.withDefaultTags(tags).withAutoUpdatePolicy(AutoUpdatePolicy.VETO).build();
Channel result = ChannelDTOMapper.map(ChannelDTOMapper.map(subject));
assertThat(result, is(instanceOf(Channel.class)));
assertThat(result.getChannelTypeUID(), is(CHANNEL_TYPE_UID));

View File

@ -16,7 +16,6 @@ import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@ -44,7 +43,7 @@ public class ThingDTOTest {
private static final ThingTypeUID THING_TYPE_UID = new ThingTypeUID("binding-id", "thing-type-id");
private static final ThingUID THING_UID = new ThingUID(THING_TYPE_UID, "thing-id");
private final Map<String, String> properties = Collections.singletonMap("key1", "value1");
private final Map<String, String> properties = Map.of("key1", "value1");
@Test
public void testThingDTOMappingIsBidirectional() {
@ -53,8 +52,8 @@ public class ThingDTOTest {
.withChannels(
ChannelBuilder.create(new ChannelUID(THING_UID, "channel1"), CoreItemFactory.STRING).build(),
ChannelBuilder.create(new ChannelUID(THING_UID, "channel2"), CoreItemFactory.STRING).build())
.withConfiguration(new Configuration(Collections.singletonMap("param1", "value1")))
.withProperties(properties).withLocation("Somewhere over the rainbow").build();
.withConfiguration(new Configuration(Map.of("param1", "value1"))).withProperties(properties)
.withLocation("Somewhere over the rainbow").build();
Thing result = ThingDTOMapper.map(ThingDTOMapper.map(subject), false);
assertThat(result, is(instanceOf(ThingImpl.class)));
assertThat(result.getThingTypeUID(), is(THING_TYPE_UID));

View File

@ -17,7 +17,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import org.junit.jupiter.api.BeforeEach;
@ -96,7 +96,7 @@ public class FirmwareEventFactoryTest extends JavaTest {
public void testSerializationAndDeserializationFirmwareUpdateProgressInfo() throws Exception {
FirmwareUpdateProgressInfo firmwareUpdateProgressInfo = FirmwareUpdateProgressInfo
.createFirmwareUpdateProgressInfo(thingUID, "1.2.3", ProgressStep.UPDATING,
Arrays.asList(ProgressStep.WAITING, ProgressStep.UPDATING), false, 10);
List.of(ProgressStep.WAITING, ProgressStep.UPDATING), false, 10);
FirmwareUpdateProgressInfoEvent progressInfoEvent = FirmwareEventFactory
.createFirmwareUpdateProgressInfoEvent(firmwareUpdateProgressInfo);

View File

@ -16,7 +16,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.*;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
@ -333,7 +332,7 @@ public class AutoUpdateManagerTest {
@Test
public void testAutoUpdateDisabled() {
aum.modified(Collections.singletonMap(AutoUpdateManager.PROPERTY_ENABLED, "false"));
aum.modified(Map.of(AutoUpdateManager.PROPERTY_ENABLED, "false"));
aum.receiveCommand(event, item);
@ -343,7 +342,7 @@ public class AutoUpdateManagerTest {
@Test
public void testAutoUpdateSendOptimisticUpdates() {
links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_1));
aum.modified(Collections.singletonMap(AutoUpdateManager.PROPERTY_SEND_OPTIMISTIC_UPDATES, "true"));
aum.modified(Map.of(AutoUpdateManager.PROPERTY_SEND_OPTIMISTIC_UPDATES, "true"));
aum.receiveCommand(event, item);

View File

@ -12,15 +12,16 @@
*/
package org.openhab.core.thing.internal;
import static java.util.Map.entry;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Collections;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import org.eclipse.jdt.annotation.NonNull;
@ -79,10 +80,7 @@ public class ChannelItemProviderTest {
public void setup() {
provider = createProvider();
Map<String, Object> props = new HashMap<>();
props.put("enabled", "true");
props.put("initialDelay", "false");
provider.activate(props);
provider.activate(Map.ofEntries(entry("enabled", "true"), entry("initialDelay", "false")));
when(thingRegistryMock.getChannel(same(CHANNEL_UID))).thenReturn(CHANNEL);
when(itemFactoryMock.createItem(CoreItemFactory.NUMBER, ITEM_NAME)).thenReturn(ITEM);
@ -199,8 +197,8 @@ public class ChannelItemProviderTest {
provider.itemRegistryListener.beforeAdding((Item) invocation.getArguments()[1]);
return null;
}).when(listenerMock).added(same(provider), any(Item.class));
when(linkRegistryMock.getBoundChannels(eq(ITEM_NAME))).thenReturn(Collections.singleton(CHANNEL_UID));
when(linkRegistryMock.getLinks(eq(CHANNEL_UID))).thenReturn(Collections.singleton(LINK));
when(linkRegistryMock.getBoundChannels(eq(ITEM_NAME))).thenReturn(Set.of(CHANNEL_UID));
when(linkRegistryMock.getLinks(eq(CHANNEL_UID))).thenReturn(Set.of(LINK));
}
private ChannelItemProvider createProvider() {

View File

@ -20,7 +20,6 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
import java.math.BigDecimal;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Arrays;
import java.util.List;
import org.junit.jupiter.api.BeforeEach;
@ -44,7 +43,7 @@ public class ChannelTypeBuilderTest {
private static final String CATEGORY = "category";
private static final String LABEL = "label";
private static final String TAG = "tag";
private static final List<String> TAGS = Arrays.asList("TAG1", "TAG2");
private static final List<String> TAGS = List.of("TAG1", "TAG2");
private static URI configDescriptionUri;
private static final ChannelTypeUID CHANNEL_TYPE_UID = new ChannelTypeUID("bindingId", "channelId");
private static final StateDescriptionFragment STATE_DESCRIPTION_FRAGMENT = StateDescriptionFragmentBuilder.create()
@ -52,7 +51,7 @@ public class ChannelTypeBuilderTest {
.build();
private static final StateDescription STATE_DESCRIPTION = STATE_DESCRIPTION_FRAGMENT.toStateDescription();
private static final EventDescription EVENT_DESCRIPTION = new EventDescription(
Arrays.asList(new EventOption(CommonTriggerEvents.DIR1_PRESSED, null),
List.of(new EventOption(CommonTriggerEvents.DIR1_PRESSED, null),
new EventOption(CommonTriggerEvents.DIR1_RELEASED, null)));
private StateChannelTypeBuilder stateBuilder;

View File

@ -20,7 +20,6 @@ import static org.mockito.Mockito.mock;
import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -178,9 +177,7 @@ public class ThingTypeBuilderTest {
@Test
public void withExtensibleChannelTypeIdsShouldSetUnmodifiableExtensibleChannelTypeIds() {
ThingType thingType = builder
.withExtensibleChannelTypeIds(Arrays.asList(new String[] { "channelTypeId1", "channelTypeId2" }))
.build();
ThingType thingType = builder.withExtensibleChannelTypeIds(List.of("channelTypeId1", "channelTypeId2")).build();
assertThat(thingType.getExtensibleChannelTypeIds(), is(hasSize(2)));
try {
@ -193,8 +190,7 @@ public class ThingTypeBuilderTest {
@Test
public void withSupportedBridgeTypeUIDsShouldSetUnmodifiableSupportedBridgeTypeUIDs() {
ThingType thingType = builder.withSupportedBridgeTypeUIDs(Arrays.asList(new String[] { "bridgeTypeUID1" }))
.build();
ThingType thingType = builder.withSupportedBridgeTypeUIDs(List.of("bridgeTypeUID1")).build();
assertThat(thingType.getSupportedBridgeTypeUIDs(), is(hasSize(1)));
try {

View File

@ -12,10 +12,10 @@
*/
package org.openhab.core.thing.util;
import static java.util.Collections.singletonList;
import static java.util.stream.Collectors.toList;
import static org.junit.jupiter.api.Assertions.*;
import java.util.List;
import java.util.stream.Stream;
import org.junit.jupiter.api.Test;
@ -90,8 +90,8 @@ public class ThingHelperTest {
assertTrue(ThingHelper.equals(thingA, thingB));
((ThingImpl) thingB).setChannels(singletonList(
ChannelBuilder.create(new ChannelUID("binding:type:thingId:channel3"), "itemType3").build()));
((ThingImpl) thingB).setChannels(
List.of(ChannelBuilder.create(new ChannelUID("binding:type:thingId:channel3"), "itemType3").build()));
assertFalse(ThingHelper.equals(thingA, thingB));
}

View File

@ -12,20 +12,17 @@
*/
package org.openhab.core.ui.internal.chart;
import static java.util.Map.entry;
import java.awt.image.BufferedImage;
import java.io.EOFException;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.AbstractMap.SimpleEntry;
import java.util.Collections;
import java.util.Date;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.imageio.IIOException;
import javax.imageio.ImageIO;
@ -89,15 +86,15 @@ public class ChartServlet extends SmartHomeServlet {
// The URI of this servlet
public static final String SERVLET_NAME = "/chart";
protected static final Map<String, Long> PERIODS = Collections.unmodifiableMap(Stream.of( //
new SimpleEntry<>("h", 3600000L), new SimpleEntry<>("4h", 14400000L), //
new SimpleEntry<>("8h", 28800000L), new SimpleEntry<>("12h", 43200000L), //
new SimpleEntry<>("D", 86400000L), new SimpleEntry<>("2D", 172800000L), //
new SimpleEntry<>("3D", 259200000L), new SimpleEntry<>("W", 604800000L), //
new SimpleEntry<>("2W", 1209600000L), new SimpleEntry<>("M", 2592000000L), //
new SimpleEntry<>("2M", 5184000000L), new SimpleEntry<>("4M", 10368000000L), //
new SimpleEntry<>("Y", 31536000000L)//
).collect(Collectors.toMap(Entry::getKey, Entry::getValue)));
protected static final Map<String, Long> PERIODS = Map.ofEntries( //
entry("h", 3600000L), entry("4h", 14400000L), //
entry("8h", 28800000L), entry("12h", 43200000L), //
entry("D", 86400000L), entry("2D", 172800000L), //
entry("3D", 259200000L), entry("W", 604800000L), //
entry("2W", 1209600000L), entry("M", 2592000000L), //
entry("2M", 5184000000L), entry("4M", 10368000000L), //
entry("Y", 31536000000L)//
);
protected static final Map<String, ChartProvider> CHART_PROVIDERS = new ConcurrentHashMap<>();

View File

@ -63,9 +63,9 @@ public class VoiceConsoleCommandExtension extends AbstractConsoleCommandExtensio
@Override
public List<String> getUsages() {
return Arrays.asList(new String[] { buildCommandUsage(SUBCMD_SAY + " <text>", "speaks a text"),
return List.of(buildCommandUsage(SUBCMD_SAY + " <text>", "speaks a text"),
buildCommandUsage(SUBCMD_INTERPRET + " <command>", "interprets a human language command"),
buildCommandUsage(SUBCMD_VOICES, "lists available voices of the TTS services") });
buildCommandUsage(SUBCMD_VOICES, "lists available voices of the TTS services"));
}
@Override

View File

@ -44,7 +44,7 @@ import org.slf4j.LoggerFactory;
public abstract class AbstractRuleBasedInterpreter implements HumanLanguageInterpreter {
private static final String JSGF = "JSGF";
private static final Set<String> SUPPORTED_GRAMMERS = Collections.unmodifiableSet(Collections.singleton(JSGF));
private static final Set<String> SUPPORTED_GRAMMERS = Set.of(JSGF);
private static final String OK = "ok";
private static final String SORRY = "sorry";

Some files were not shown because too many files have changed in this diff Show More