public final class ServiceDiscovererUtils
extends java.lang.Object
ServiceDiscoverer
.Modifier and Type | Method and Description |
---|---|
static <T> java.util.List<ServiceDiscovererEvent<T>> |
calculateDifference(java.util.List<? extends T> currentActiveAddresses,
java.util.List<? extends T> newActiveAddresses,
java.util.Comparator<T> comparator)
Given a sorted list of currently active addresses, and a new set of unsorted active address calculate the
ServiceDiscovererEvent s. |
@Nullable public static <T> java.util.List<ServiceDiscovererEvent<T>> calculateDifference(java.util.List<? extends T> currentActiveAddresses, java.util.List<? extends T> newActiveAddresses, java.util.Comparator<T> comparator)
ServiceDiscovererEvent
s.
newActiveAddresses
will be sorted in this method.
T
- The type of address.currentActiveAddresses
- The currently active addresses.newActiveAddresses
- The new list of active addresses.This list must be modifiable as it will be
sorted with List.sort(Comparator)
.comparator
- A comparator for the addresses and to use for binary searches.ServiceDiscovererEvent
s which represents the changes between
currentActiveAddresses
and newActiveAddresses
, or null
if there are no changes.