/** * Converts a collection of collections of {@link ElkEntity}-ies to an * object that can be tested for semantic equality with other entity * collection collection converted in this way by * {@link Object#equals(Object)}. * * (This does not generally work by calling {@link Object#equals(Object)} * directly on the collection, because IRI-s of the entities may be * abbreviated.) * * @param related * The entity collection collection. * @param comparator * Comparator that compares entities semantically. * @return */ public static <E extends ElkEntity> List<List<E>> relatedNodes2Equalable( final Collection<? extends Node<E>> related, final Comparator<? super E> comparator) { final List<List<E>> result = new ArrayList<List<E>>(related.size()); for (final Node<E> rel : related) { result.add(entities2Equalable(rel, comparator)); } Collections.sort(result, Operations.<E>lexicalOrder(comparator)); return result; }
/** * Converts a collection of collections of {@link ElkEntity}-ies to an * object that can be tested for semantic equality with other entity * collection collection converted in this way by * {@link Object#equals(Object)}. * * (This does not generally work by calling {@link Object#equals(Object)} * directly on the collection, because IRI-s of the entities may be * abbreviated.) * * @param related * The entity collection collection. * @param comparator * Comparator that compares entities semantically. * @return */ public static <E extends ElkEntity> List<List<E>> related2Equalable( final Collection<? extends Collection<E>> related, final Comparator<? super E> comparator) { final List<List<E>> result = new ArrayList<List<E>>(related.size()); for (final Collection<E> rel : related) { result.add(entities2Equalable(rel, comparator)); } Collections.sort(result, Operations.<E>lexicalOrder(comparator)); return result; }