public void add(int index,Entity entity){
  if (entities.contains(entity)) {
    throw new IllegalStateException("ToMany relation already contains '" + entity + "'");
  }
  if (entity.getEntityType() != entityType) {
    throw new IllegalStateException("Cannot add " + entity.getEntityType() + " to "+ getParent()+ "."+ getName());
  }
  if (entity.isClearlyNotInDatabase()) {
    newEntities.add(entity);
  }
  entities.add(index,entity);
}

public void add ( int index , Entity entity ) { if ( entities . contains ( entity ) ) { throw new IllegalStateException ( "ToMany relation already contains '" + entity + "'" ) ; } if ( entity . getEntityType ( ) != entityType ) { throw new IllegalStateException ( "Cannot add " + entity . getEntityType ( ) + " to " + getParent ( ) + "." + getName ( ) ) ; } if ( entity . isClearlyNotInDatabase ( ) ) { newEntities . add ( entity ) ; } entities . add ( index , entity ) ; }
we are adding an entity to this list .
