protected boolean contains(Collection links, Object o) { for (Iterator iter = links.iterator(); iter.hasNext(); ) { Link link = (Link) iter.next(); if (link.getSource() == o || link.getTarget() == o) { return true; } } return false; }
/** * Returns the nullable {@link Link#getTarget() target} of the given link. The returned target is * {@code null} if and only if either the given link is {@code null} or its target is {@code * null}. * * @param <T> The type of the target. * @param link a nullable link. * @return The nullable {@link Link#getTarget() target} of the given link. */ public static <T> T getTarget(Link<T> link) { return null == link ? null : link.getTarget(); }
public static PVLink create(Link link) { return create(link.getSource(), link.getTarget(), link.getValue()); }