2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-30 05:37:43 +00:00

Use SetUtils in PluginFactory.

This commit is contained in:
Isira Seneviratne 2020-07-08 08:11:10 +05:30 committed by Nicolas Fella
parent 144d5d431d
commit 87c1c44e68

View File

@ -34,6 +34,9 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import static org.apache.commons.collections4.SetUtils.emptyIfNull;
import static org.apache.commons.collections4.SetUtils.unmodifiableSet;
public class PluginFactory {
@IndexAnnotated
@ -52,12 +55,8 @@ public class PluginFactory {
this.hasSettings = hasSettings;
this.supportsDeviceSpecificSettings = supportsDeviceSpecificSettings;
this.listenToUnpaired = listenToUnpaired;
HashSet<String> incoming = new HashSet<>();
if (supportedPacketTypes != null) Collections.addAll(incoming, supportedPacketTypes);
this.supportedPacketTypes = Collections.unmodifiableSet(incoming);
HashSet<String> outgoing = new HashSet<>();
if (outgoingPacketTypes != null) Collections.addAll(outgoing, outgoingPacketTypes);
this.outgoingPacketTypes = Collections.unmodifiableSet(outgoing);
this.supportedPacketTypes = emptyIfNull(unmodifiableSet(supportedPacketTypes));
this.outgoingPacketTypes = emptyIfNull(unmodifiableSet(outgoingPacketTypes));
this.instantiableClass = instantiableClass;
}