Let the entries be unique

This commit is contained in:
Mygod
2020-06-26 01:11:45 +08:00
parent a5cdec2049
commit db30f1e4fb

View File

@@ -80,6 +80,7 @@ data class IpNeighbour(val ip: InetAddress, val dev: String, val lladdr: MacAddr
.asSequence() .asSequence()
.filter { parseNumericAddress(it[ARP_IP_ADDRESS]) == ip && it[ARP_DEVICE] == dev } .filter { parseNumericAddress(it[ARP_IP_ADDRESS]) == ip && it[ARP_DEVICE] == dev }
.map { it[ARP_HW_ADDRESS] } .map { it[ARP_HW_ADDRESS] }
.distinct()
.singleOrNull() ?: throw IllegalArgumentException("singleOrNull")) .singleOrNull() ?: throw IllegalArgumentException("singleOrNull"))
} catch (e: IllegalArgumentException) { } catch (e: IllegalArgumentException) {
Timber.w(e) Timber.w(e)