- eps.get(0);
- ImmutableSet<AddressEndpointKey> copyOf = ImmutableSet.copyOf(eps.stream()
- .filter(addrEp -> AddressEndpointUtils.sameExternalLocationCase(eps.get(0), addrEp))
+ // look for any end-point with absolute location as reference end-point in this cycle;
+ java.util.Optional<AddressEndpointWithLocation> refEndpoint =
+ eps.stream().filter(ep -> EndpointUtils.getExternalLocationFrom(ep).isPresent()).findAny();
+ if (!refEndpoint.isPresent()) {
+ return;
+ }
+ Predicate<AddressEndpointWithLocation> sameLocation = new Predicate<AddressEndpointWithLocation>() {
+ @Override
+ public boolean test(AddressEndpointWithLocation addrEp) {
+ return AddressEndpointUtils.sameExternalLocationCase(refEndpoint.get(), addrEp);
+ }
+ };
+ Optional<ExternalLocationCase> extLoc = EndpointUtils.getExternalLocationFrom(refEndpoint.get());
+ Set<AddressEndpointKey> sameLocations = eps.stream()
+ .filter(sameLocation)