protected Stream<Relation> createMeshedRelations(final JCas jCas,final Interaction interaction,final Collection<Entity> collection){
  final List<Relation> relations=new LinkedList<>();
  List<Entity> entities;
  if (collection instanceof List) {
    entities=(List<Entity>)collection;
  }
 else {
    entities=new ArrayList<>(collection);
  }
  final ListIterator<Entity> outer=entities.listIterator();
  while (outer.hasNext()) {
    final Entity source=outer.next();
    final ListIterator<Entity> inner=entities.listIterator(outer.nextIndex());
    while (inner.hasNext()) {
      final Entity target=inner.next();
      relations.add(createRelation(jCas,interaction,source,target));
    }
  }
  return relations.stream();
}

protected Stream < Relation > createMeshedRelations ( final JCas jCas , final Interaction interaction , final Collection < Entity > collection ) { final List < Relation > relations = new LinkedList < > ( ) ; List < Entity > entities ; if ( collection instanceof List ) { entities = ( List < Entity > ) collection ; } else { entities = new ArrayList < > ( collection ) ; } final ListIterator < Entity > outer = entities . listIterator ( ) ; while ( outer . hasNext ( ) ) { final Entity source = outer . next ( ) ; final ListIterator < Entity > inner = entities . listIterator ( outer . nextIndex ( ) ) ; while ( inner . hasNext ( ) ) { final Entity target = inner . next ( ) ; relations . add ( createRelation ( jCas , interaction , source , target ) ) ; } } return relations . stream ( ) ; }
creates the relations between all the entities provided ( but not between an entity adn itself ) .
