@Test public void testFindLinkIn() { LinkComparator comparator = new LinkComparator(); ILink link = new LinkBean("test", ILink.VALUE_SELF, ILink.VALUE_NIL); Collection<ILink> links = ImmutableList.of( new LinkBean("test", ILink.VALUE_NIL, ILink.VALUE_NIL), new LinkBean("test-02", ILink.VALUE_SELF, ILink.VALUE_SELF), new LinkBean("test-03", ILink.VALUE_SELF, ILink.VALUE_NIL), new LinkBean("test-04", ILink.VALUE_SELF, ILink.VALUE_NIL), new LinkBean("test-05", ILink.VALUE_SELF, ILink.VALUE_NIL), new LinkBean("test", ILink.VALUE_SELF, ILink.VALUE_NIL), link); Collection<ILink> matchingLinks = LinkUtilities.findMatchingLinksIn(links, link); Assert.assertTrue("No match was found", matchingLinks.size() == 2); }
public static Collection<ILink> findMatchingLinksIn(Collection<ILink> links, final ILink templateLink) { return Collections2.filter(links, new Predicate<ILink>() { public boolean apply(ILink input) { return COMPARATOR.compare(input, templateLink) == 0; } }); }
LinkUtilities { public static Collection<ILink> findMatchingLinksIn(Collection<ILink> links, final ILink templateLink) { return Collections2.filter(links, new Predicate<ILink>() { public boolean apply(ILink input) { return COMPARATOR.compare(input, templateLink) == 0; } }); } }
LinkUtilities { public static Collection<ILink> findMatchingLinksIn(Collection<ILink> links, final ILink templateLink) { return Collections2.filter(links, new Predicate<ILink>() { public boolean apply(ILink input) { return COMPARATOR.compare(input, templateLink) == 0; } }); }  }
LinkUtilities { public static Collection<ILink> findMatchingLinksIn(Collection<ILink> links, final ILink templateLink) { return Collections2.filter(links, new Predicate<ILink>() { public boolean apply(ILink input) { return COMPARATOR.compare(input, templateLink) == 0; } }); }  static String formatAsLongString(ILink link); static String formatAsString(ILink link); static Collection<ILink> findMatchingLinksIn(Collection<ILink> links, final ILink templateLink); }
LinkUtilities { public static Collection<ILink> findMatchingLinksIn(Collection<ILink> links, final ILink templateLink) { return Collections2.filter(links, new Predicate<ILink>() { public boolean apply(ILink input) { return COMPARATOR.compare(input, templateLink) == 0; } }); }  static String formatAsLongString(ILink link); static String formatAsString(ILink link); static Collection<ILink> findMatchingLinksIn(Collection<ILink> links, final ILink templateLink);  }