@Test public void testLookupEndpoint() throws Exception { final AddressEndpointKey key1 = new AddressEndpointBuilder() .setAddress("address1") .setAddressType(IpPrefixType.class) .setContextId(new ContextId("context1")) .setContextType(L3Context.class) .build(); final AddressEndpointWithLocation addressEPWithLocation1 = createAddressEPWithLocation("address1", IpPrefixType.class, "context1", L3Context.class); final AddressEndpointWithLocation addressEPWithLocation2 = createAddressEPWithLocation("address2", IpPrefixType.class, "context1", L3Context.class); final AddressEndpointWithLocation addressEPWithLocation3 = createAddressEPWithLocation("address1", MacAddressType.class, "context1", L3Context.class); final AddressEndpointWithLocation addressEPWithLocation4 = createAddressEPWithLocation("address1", IpPrefixType.class, "context2", L3Context.class); final AddressEndpointWithLocation addressEPWithLocation5 = createAddressEPWithLocation("address1", IpPrefixType.class, "context1", L2BridgeDomain.class); final List<AddressEndpointWithLocation> endpoints = Lists.newArrayList( addressEPWithLocation2, addressEPWithLocation3, addressEPWithLocation4, addressEPWithLocation5, addressEPWithLocation1 ); final AddressEndpointWithLocation actualEndpoint = RendererPolicyUtil.lookupEndpoint(key1, endpoints); Assert.assertSame(addressEPWithLocation1, actualEndpoint); }
public static AddressEndpointWithLocation lookupEndpoint(final AddressEndpointKey rendererEp, final List<AddressEndpointWithLocation> addressEndpointWithLocation) { final Predicate<AddressEndpointKey> addressEndpointKeyPredicate = ADDRESS_EP_KEY_EQUIVALENCE.equivalentTo(rendererEp); AddressEndpointWithLocation needle = null; for (AddressEndpointWithLocation ep : addressEndpointWithLocation) { if (addressEndpointKeyPredicate.apply(ep)) { needle = ep; break; } } return needle; }
RendererPolicyUtil { public static AddressEndpointWithLocation lookupEndpoint(final AddressEndpointKey rendererEp, final List<AddressEndpointWithLocation> addressEndpointWithLocation) { final Predicate<AddressEndpointKey> addressEndpointKeyPredicate = ADDRESS_EP_KEY_EQUIVALENCE.equivalentTo(rendererEp); AddressEndpointWithLocation needle = null; for (AddressEndpointWithLocation ep : addressEndpointWithLocation) { if (addressEndpointKeyPredicate.apply(ep)) { needle = ep; break; } } return needle; } }
RendererPolicyUtil { public static AddressEndpointWithLocation lookupEndpoint(final AddressEndpointKey rendererEp, final List<AddressEndpointWithLocation> addressEndpointWithLocation) { final Predicate<AddressEndpointKey> addressEndpointKeyPredicate = ADDRESS_EP_KEY_EQUIVALENCE.equivalentTo(rendererEp); AddressEndpointWithLocation needle = null; for (AddressEndpointWithLocation ep : addressEndpointWithLocation) { if (addressEndpointKeyPredicate.apply(ep)) { needle = ep; break; } } return needle; } private  RendererPolicyUtil(); }
RendererPolicyUtil { public static AddressEndpointWithLocation lookupEndpoint(final AddressEndpointKey rendererEp, final List<AddressEndpointWithLocation> addressEndpointWithLocation) { final Predicate<AddressEndpointKey> addressEndpointKeyPredicate = ADDRESS_EP_KEY_EQUIVALENCE.equivalentTo(rendererEp); AddressEndpointWithLocation needle = null; for (AddressEndpointWithLocation ep : addressEndpointWithLocation) { if (addressEndpointKeyPredicate.apply(ep)) { needle = ep; break; } } return needle; } private  RendererPolicyUtil(); static AddressEndpointWithLocation lookupEndpoint(final AddressEndpointKey rendererEp, final List<AddressEndpointWithLocation> addressEndpointWithLocation); static Ordering<EndpointGroupId> createEndpointGroupIdOrdering(); static Ordering<ConditionName> createConditionNameOrdering(); }
RendererPolicyUtil { public static AddressEndpointWithLocation lookupEndpoint(final AddressEndpointKey rendererEp, final List<AddressEndpointWithLocation> addressEndpointWithLocation) { final Predicate<AddressEndpointKey> addressEndpointKeyPredicate = ADDRESS_EP_KEY_EQUIVALENCE.equivalentTo(rendererEp); AddressEndpointWithLocation needle = null; for (AddressEndpointWithLocation ep : addressEndpointWithLocation) { if (addressEndpointKeyPredicate.apply(ep)) { needle = ep; break; } } return needle; } private  RendererPolicyUtil(); static AddressEndpointWithLocation lookupEndpoint(final AddressEndpointKey rendererEp, final List<AddressEndpointWithLocation> addressEndpointWithLocation); static Ordering<EndpointGroupId> createEndpointGroupIdOrdering(); static Ordering<ConditionName> createConditionNameOrdering();  }