@Test public void mergingListWithIdenticalLinksShouldResultInSingleLink() throws Exception { final List<? extends ResourceLink> resourceLinks = mergeResources( asList(STOREFRONT_LINK), asList(STOREFRONT_LINK) ); assertEquals(resourceLinks, asList(STOREFRONT_LINK)); }
public static List<? extends ResourceLink> mergeResources(final List<? extends ResourceLink> resourceLinks, final List<? extends ResourceLink> other) { if (other.isEmpty()) { return resourceLinks; } else { List<? extends ResourceLink> result = resourceLinks; for (final ResourceLink resourceLink : other) { result = mergeResources(result, resourceLink); } return result; } }
ResourceLinkHelper { public static List<? extends ResourceLink> mergeResources(final List<? extends ResourceLink> resourceLinks, final List<? extends ResourceLink> other) { if (other.isEmpty()) { return resourceLinks; } else { List<? extends ResourceLink> result = resourceLinks; for (final ResourceLink resourceLink : other) { result = mergeResources(result, resourceLink); } return result; } } }
ResourceLinkHelper { public static List<? extends ResourceLink> mergeResources(final List<? extends ResourceLink> resourceLinks, final List<? extends ResourceLink> other) { if (other.isEmpty()) { return resourceLinks; } else { List<? extends ResourceLink> result = resourceLinks; for (final ResourceLink resourceLink : other) { result = mergeResources(result, resourceLink); } return result; } } private  ResourceLinkHelper(); }
ResourceLinkHelper { public static List<? extends ResourceLink> mergeResources(final List<? extends ResourceLink> resourceLinks, final List<? extends ResourceLink> other) { if (other.isEmpty()) { return resourceLinks; } else { List<? extends ResourceLink> result = resourceLinks; for (final ResourceLink resourceLink : other) { result = mergeResources(result, resourceLink); } return result; } } private  ResourceLinkHelper(); static List<? extends ResourceLink> mergeResources(final List<? extends ResourceLink> resourceLinks,
                                                    final List<? extends ResourceLink> other); static List<? extends ResourceLink> mergeResources(final List<? extends ResourceLink> resourceLinks,
                                                    final ResourceLink other); }
ResourceLinkHelper { public static List<? extends ResourceLink> mergeResources(final List<? extends ResourceLink> resourceLinks, final List<? extends ResourceLink> other) { if (other.isEmpty()) { return resourceLinks; } else { List<? extends ResourceLink> result = resourceLinks; for (final ResourceLink resourceLink : other) { result = mergeResources(result, resourceLink); } return result; } } private  ResourceLinkHelper(); static List<? extends ResourceLink> mergeResources(final List<? extends ResourceLink> resourceLinks,
                                                    final List<? extends ResourceLink> other); static List<? extends ResourceLink> mergeResources(final List<? extends ResourceLink> resourceLinks,
                                                    final ResourceLink other);  }