protected Collection<DataSupport> checkAssociatedModelCollection(Collection<DataSupport> associatedModelCollection,Field associatedField){
  Collection<DataSupport> collection=null;
  if (isList(associatedField.getType())) {
    collection=new ArrayList<DataSupport>();
  }
 else   if (isSet(associatedField.getType())) {
    collection=new HashSet<DataSupport>();
  }
 else {
    throw new DataSupportException(DataSupportException.WRONG_FIELD_TYPE_FOR_ASSOCIATIONS);
  }
  if (associatedModelCollection != null) {
    collection.addAll(associatedModelCollection);
  }
  return collection;
}

protected Collection < DataSupport > checkAssociatedModelCollection ( Collection < DataSupport > associatedModelCollection , Field associatedField ) { Collection < DataSupport > collection = null ; if ( isList ( associatedField . getType ( ) ) ) { collection = new ArrayList < DataSupport > ( ) ; } else if ( isSet ( associatedField . getType ( ) ) ) { collection = new HashSet < DataSupport > ( ) ; } else { throw new DataSupportException ( DataSupportException . WRONG_FIELD_TYPE_FOR_ASSOCIATIONS ) ; } if ( associatedModelCollection != null ) { collection . addAll ( associatedModelCollection ) ; } return collection ; }
check the associated model collection . if the associated model collection is null , try to initialize the associated model collection by the given associated field . if the associated field is subclass of list , make an instance of arraylist for associated model collection . if the associated field is subclass of set , make an instance of hashset for associated model collection . if the associated model collection is not null , doing nothing .
