Does ModelMapper library support collections like ArrayList or HashSet?

You can also map collections () directly:

    List<Person> persons = getPersons();
    // Define the target type
    java.lang.reflect.Type targetListType = new TypeToken<List<PersonDTO>>() {}.getType();
    List<PersonDTO> personDTOs = mapper.map(persons, targetListType);

Documentation on mapping Generics.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)