mirror of
https://github.com/mapstruct/mapstruct.git
synced 2025-07-12 00:00:08 +08:00
#2303 Generated code should use iteration order preserving LinkedHash(Map|Set) instead of Hash(Map|Set)
This commit is contained in:
parent
5f1b3d7862
commit
2be536bb65
@ -180,7 +180,7 @@ By default the target property will be set to null.
|
||||
However:
|
||||
|
||||
1. By specifying `nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.SET_TO_DEFAULT` on `@Mapping`, `@BeanMapping`, `@Mapper` or `@MapperConfig`, the mapping result can be altered to return *default* values.
|
||||
For `List` MapStruct generates an `ArrayList`, for `Map` a `HashMap`, for arrays an empty array, for `String` `""` and for primitive / boxed types a representation of `false` or `0`.
|
||||
For `List` MapStruct generates an `ArrayList`, for `Map` a `LinkedHashMap`, for arrays an empty array, for `String` `""` and for primitive / boxed types a representation of `false` or `0`.
|
||||
For all other objects an new instance is created. Please note that a default constructor is required. If not available, use the `@Mapping#defaultValue`.
|
||||
|
||||
2. By specifying `nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE` on `@Mapping`, `@BeanMapping`, `@Mapper` or `@MapperConfig`, the mapping result will be equal to the original value of the `@MappingTarget` annotated target.
|
||||
|
@ -36,7 +36,7 @@ public Set<String> integerSetToStringSet(Set<Integer> integers) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Set<String> set = new HashSet<String>();
|
||||
Set<String> set = new LinkedHashSet<String>();
|
||||
|
||||
for ( Integer integer : integers ) {
|
||||
set.add( String.valueOf( integer ) );
|
||||
@ -125,7 +125,7 @@ public Map<Long, Date> stringStringMapToLongDateMap(Map<String, String> source)
|
||||
return null;
|
||||
}
|
||||
|
||||
Map<Long, Date> map = new HashMap<Long, Date>();
|
||||
Map<Long, Date> map = new LinkedHashMap<Long, Date>();
|
||||
|
||||
for ( Map.Entry<String, String> entry : source.entrySet() ) {
|
||||
|
||||
@ -210,13 +210,13 @@ When an iterable or map mapping method declares an interface type as return type
|
||||
|
||||
|`List`|`ArrayList`
|
||||
|
||||
|`Set`|`HashSet`
|
||||
|`Set`|`LinkedHashSet`
|
||||
|
||||
|`SortedSet`|`TreeSet`
|
||||
|
||||
|`NavigableSet`|`TreeSet`
|
||||
|
||||
|`Map`|`HashMap`
|
||||
|`Map`|`LinkedHashMap`
|
||||
|
||||
|`SortedMap`|`TreeMap`
|
||||
|
||||
|
@ -42,7 +42,7 @@ public Set<String> integerStreamToStringSet(Stream<Integer> integers) {
|
||||
}
|
||||
|
||||
return integers.map( integer -> String.valueOf( integer ) )
|
||||
.collect( Collectors.toCollection( HashSet<String>::new ) );
|
||||
.collect( Collectors.toCollection( LinkedHashSet<String>::new ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -10,6 +10,8 @@ import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.NavigableMap;
|
||||
@ -116,11 +118,11 @@ public class TypeFactory {
|
||||
implementationTypes.put( Collection.class.getName(), withInitialCapacity( getType( ArrayList.class ) ) );
|
||||
implementationTypes.put( List.class.getName(), withInitialCapacity( getType( ArrayList.class ) ) );
|
||||
|
||||
implementationTypes.put( Set.class.getName(), withLoadFactorAdjustment( getType( HashSet.class ) ) );
|
||||
implementationTypes.put( Set.class.getName(), withLoadFactorAdjustment( getType( LinkedHashSet.class ) ) );
|
||||
implementationTypes.put( SortedSet.class.getName(), withDefaultConstructor( getType( TreeSet.class ) ) );
|
||||
implementationTypes.put( NavigableSet.class.getName(), withDefaultConstructor( getType( TreeSet.class ) ) );
|
||||
|
||||
implementationTypes.put( Map.class.getName(), withLoadFactorAdjustment( getType( HashMap.class ) ) );
|
||||
implementationTypes.put( Map.class.getName(), withLoadFactorAdjustment( getType( LinkedHashMap.class ) ) );
|
||||
implementationTypes.put( SortedMap.class.getName(), withDefaultConstructor( getType( TreeMap.class ) ) );
|
||||
implementationTypes.put( NavigableMap.class.getName(), withDefaultConstructor( getType( TreeMap.class ) ) );
|
||||
implementationTypes.put(
|
||||
|
@ -6,7 +6,7 @@
|
||||
package org.mapstruct.ap.test.bugs._1453;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.annotation.Generated;
|
||||
@ -68,7 +68,7 @@ public class Issue1453MapperImpl implements Issue1453Mapper {
|
||||
return null;
|
||||
}
|
||||
|
||||
Map<AuctionDto, AuctionDto> map = new HashMap<AuctionDto, AuctionDto>( Math.max( (int) ( auctions.size() / .75f ) + 1, 16 ) );
|
||||
Map<AuctionDto, AuctionDto> map = new LinkedHashMap<AuctionDto, AuctionDto>( Math.max( (int) ( auctions.size() / .75f ) + 1, 16 ) );
|
||||
|
||||
for ( java.util.Map.Entry<? extends Auction, ? extends Auction> entry : auctions.entrySet() ) {
|
||||
AuctionDto key = map( entry.getKey() );
|
||||
@ -85,7 +85,7 @@ public class Issue1453MapperImpl implements Issue1453Mapper {
|
||||
return null;
|
||||
}
|
||||
|
||||
Map<? super AuctionDto, ? super AuctionDto> map = new HashMap<AuctionDto, AuctionDto>( Math.max( (int) ( auctions.size() / .75f ) + 1, 16 ) );
|
||||
Map<? super AuctionDto, ? super AuctionDto> map = new LinkedHashMap<AuctionDto, AuctionDto>( Math.max( (int) ( auctions.size() / .75f ) + 1, 16 ) );
|
||||
|
||||
for ( java.util.Map.Entry<Auction, Auction> entry : auctions.entrySet() ) {
|
||||
AuctionDto key = map( entry.getKey() );
|
||||
@ -126,7 +126,7 @@ public class Issue1453MapperImpl implements Issue1453Mapper {
|
||||
return null;
|
||||
}
|
||||
|
||||
Map<PaymentDto, PaymentDto> map1 = new HashMap<PaymentDto, PaymentDto>( Math.max( (int) ( map.size() / .75f ) + 1, 16 ) );
|
||||
Map<PaymentDto, PaymentDto> map1 = new LinkedHashMap<PaymentDto, PaymentDto>( Math.max( (int) ( map.size() / .75f ) + 1, 16 ) );
|
||||
|
||||
for ( java.util.Map.Entry<Payment, Payment> entry : map.entrySet() ) {
|
||||
PaymentDto key = paymentToPaymentDto( entry.getKey() );
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package org.mapstruct.ap.test.bugs._1707;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
@ -24,10 +24,10 @@ public class ConverterImpl extends Converter {
|
||||
return null;
|
||||
}
|
||||
|
||||
Set<Target> set = new HashSet<Target>();
|
||||
Set<Target> set = new LinkedHashSet<Target>();
|
||||
|
||||
set.addAll( source.map( source1 -> convert( source1 ) )
|
||||
.collect( Collectors.toCollection( HashSet<Target>::new ) )
|
||||
.collect( Collectors.toCollection( LinkedHashSet<Target>::new ) )
|
||||
);
|
||||
|
||||
addCustomValue( set );
|
||||
|
@ -6,7 +6,7 @@
|
||||
package org.mapstruct.ap.test.bugs._913;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Generated;
|
||||
@ -30,14 +30,14 @@ public class DomainDtoWithNcvsAlwaysMapperImpl implements DomainDtoWithNcvsAlway
|
||||
|
||||
if ( source.hasStrings() ) {
|
||||
List<String> list = source.getStrings();
|
||||
domain.setStrings( new HashSet<String>( list ) );
|
||||
domain.setStrings( new LinkedHashSet<String>( list ) );
|
||||
}
|
||||
if ( source.hasStrings() ) {
|
||||
domain.setLongs( stringListToLongSet( source.getStrings() ) );
|
||||
}
|
||||
if ( source.hasStringsInitialized() ) {
|
||||
List<String> list1 = source.getStringsInitialized();
|
||||
domain.setStringsInitialized( new HashSet<String>( list1 ) );
|
||||
domain.setStringsInitialized( new LinkedHashSet<String>( list1 ) );
|
||||
}
|
||||
if ( source.hasStringsInitialized() ) {
|
||||
domain.setLongsInitialized( stringListToLongSet( source.getStringsInitialized() ) );
|
||||
@ -68,7 +68,7 @@ public class DomainDtoWithNcvsAlwaysMapperImpl implements DomainDtoWithNcvsAlway
|
||||
else {
|
||||
if ( source.hasStrings() ) {
|
||||
List<String> list = source.getStrings();
|
||||
target.setStrings( new HashSet<String>( list ) );
|
||||
target.setStrings( new LinkedHashSet<String>( list ) );
|
||||
}
|
||||
}
|
||||
if ( target.getLongs() != null ) {
|
||||
@ -91,7 +91,7 @@ public class DomainDtoWithNcvsAlwaysMapperImpl implements DomainDtoWithNcvsAlway
|
||||
else {
|
||||
if ( source.hasStringsInitialized() ) {
|
||||
List<String> list1 = source.getStringsInitialized();
|
||||
target.setStringsInitialized( new HashSet<String>( list1 ) );
|
||||
target.setStringsInitialized( new LinkedHashSet<String>( list1 ) );
|
||||
}
|
||||
}
|
||||
if ( target.getLongsInitialized() != null ) {
|
||||
@ -140,7 +140,7 @@ public class DomainDtoWithNcvsAlwaysMapperImpl implements DomainDtoWithNcvsAlway
|
||||
else {
|
||||
if ( source.hasStrings() ) {
|
||||
List<String> list = source.getStrings();
|
||||
target.setStrings( new HashSet<String>( list ) );
|
||||
target.setStrings( new LinkedHashSet<String>( list ) );
|
||||
}
|
||||
}
|
||||
if ( target.getLongs() != null ) {
|
||||
@ -163,7 +163,7 @@ public class DomainDtoWithNcvsAlwaysMapperImpl implements DomainDtoWithNcvsAlway
|
||||
else {
|
||||
if ( source.hasStringsInitialized() ) {
|
||||
List<String> list1 = source.getStringsInitialized();
|
||||
target.setStringsInitialized( new HashSet<String>( list1 ) );
|
||||
target.setStringsInitialized( new LinkedHashSet<String>( list1 ) );
|
||||
}
|
||||
}
|
||||
if ( target.getLongsInitialized() != null ) {
|
||||
@ -204,7 +204,7 @@ public class DomainDtoWithNcvsAlwaysMapperImpl implements DomainDtoWithNcvsAlway
|
||||
return null;
|
||||
}
|
||||
|
||||
Set<Long> set = new HashSet<Long>( Math.max( (int) ( list.size() / .75f ) + 1, 16 ) );
|
||||
Set<Long> set = new LinkedHashSet<Long>( Math.max( (int) ( list.size() / .75f ) + 1, 16 ) );
|
||||
for ( String string : list ) {
|
||||
set.add( Long.parseLong( string ) );
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
package org.mapstruct.ap.test.bugs._913;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Generated;
|
||||
@ -28,12 +28,12 @@ public class DomainDtoWithNvmsDefaultMapperImpl implements DomainDtoWithNvmsDefa
|
||||
if ( source != null ) {
|
||||
List<String> list = source.getStrings();
|
||||
if ( list != null ) {
|
||||
domain.setStrings( new HashSet<String>( list ) );
|
||||
domain.setStrings( new LinkedHashSet<String>( list ) );
|
||||
}
|
||||
domain.setLongs( stringListToLongSet( source.getStrings() ) );
|
||||
List<String> list1 = source.getStringsInitialized();
|
||||
if ( list1 != null ) {
|
||||
domain.setStringsInitialized( new HashSet<String>( list1 ) );
|
||||
domain.setStringsInitialized( new LinkedHashSet<String>( list1 ) );
|
||||
}
|
||||
domain.setLongsInitialized( stringListToLongSet( source.getStringsInitialized() ) );
|
||||
List<String> list2 = source.getStringsWithDefault();
|
||||
@ -59,13 +59,13 @@ public class DomainDtoWithNvmsDefaultMapperImpl implements DomainDtoWithNvmsDefa
|
||||
target.getStrings().addAll( list );
|
||||
}
|
||||
else {
|
||||
target.setStrings( new HashSet<String>() );
|
||||
target.setStrings( new LinkedHashSet<String>() );
|
||||
}
|
||||
}
|
||||
else {
|
||||
List<String> list = source.getStrings();
|
||||
if ( list != null ) {
|
||||
target.setStrings( new HashSet<String>( list ) );
|
||||
target.setStrings( new LinkedHashSet<String>( list ) );
|
||||
}
|
||||
}
|
||||
if ( target.getLongs() != null ) {
|
||||
@ -75,7 +75,7 @@ public class DomainDtoWithNvmsDefaultMapperImpl implements DomainDtoWithNvmsDefa
|
||||
target.getLongs().addAll( set );
|
||||
}
|
||||
else {
|
||||
target.setLongs( new HashSet<Long>() );
|
||||
target.setLongs( new LinkedHashSet<Long>() );
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -91,13 +91,13 @@ public class DomainDtoWithNvmsDefaultMapperImpl implements DomainDtoWithNvmsDefa
|
||||
target.getStringsInitialized().addAll( list1 );
|
||||
}
|
||||
else {
|
||||
target.setStringsInitialized( new HashSet<String>() );
|
||||
target.setStringsInitialized( new LinkedHashSet<String>() );
|
||||
}
|
||||
}
|
||||
else {
|
||||
List<String> list1 = source.getStringsInitialized();
|
||||
if ( list1 != null ) {
|
||||
target.setStringsInitialized( new HashSet<String>( list1 ) );
|
||||
target.setStringsInitialized( new LinkedHashSet<String>( list1 ) );
|
||||
}
|
||||
}
|
||||
if ( target.getLongsInitialized() != null ) {
|
||||
@ -107,7 +107,7 @@ public class DomainDtoWithNvmsDefaultMapperImpl implements DomainDtoWithNvmsDefa
|
||||
target.getLongsInitialized().addAll( set1 );
|
||||
}
|
||||
else {
|
||||
target.setLongsInitialized( new HashSet<Long>() );
|
||||
target.setLongsInitialized( new LinkedHashSet<Long>() );
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -149,13 +149,13 @@ public class DomainDtoWithNvmsDefaultMapperImpl implements DomainDtoWithNvmsDefa
|
||||
target.getStrings().addAll( list );
|
||||
}
|
||||
else {
|
||||
target.setStrings( new HashSet<String>() );
|
||||
target.setStrings( new LinkedHashSet<String>() );
|
||||
}
|
||||
}
|
||||
else {
|
||||
List<String> list = source.getStrings();
|
||||
if ( list != null ) {
|
||||
target.setStrings( new HashSet<String>( list ) );
|
||||
target.setStrings( new LinkedHashSet<String>( list ) );
|
||||
}
|
||||
}
|
||||
if ( target.getLongs() != null ) {
|
||||
@ -165,7 +165,7 @@ public class DomainDtoWithNvmsDefaultMapperImpl implements DomainDtoWithNvmsDefa
|
||||
target.getLongs().addAll( set );
|
||||
}
|
||||
else {
|
||||
target.setLongs( new HashSet<Long>() );
|
||||
target.setLongs( new LinkedHashSet<Long>() );
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -181,13 +181,13 @@ public class DomainDtoWithNvmsDefaultMapperImpl implements DomainDtoWithNvmsDefa
|
||||
target.getStringsInitialized().addAll( list1 );
|
||||
}
|
||||
else {
|
||||
target.setStringsInitialized( new HashSet<String>() );
|
||||
target.setStringsInitialized( new LinkedHashSet<String>() );
|
||||
}
|
||||
}
|
||||
else {
|
||||
List<String> list1 = source.getStringsInitialized();
|
||||
if ( list1 != null ) {
|
||||
target.setStringsInitialized( new HashSet<String>( list1 ) );
|
||||
target.setStringsInitialized( new LinkedHashSet<String>( list1 ) );
|
||||
}
|
||||
}
|
||||
if ( target.getLongsInitialized() != null ) {
|
||||
@ -197,7 +197,7 @@ public class DomainDtoWithNvmsDefaultMapperImpl implements DomainDtoWithNvmsDefa
|
||||
target.getLongsInitialized().addAll( set1 );
|
||||
}
|
||||
else {
|
||||
target.setLongsInitialized( new HashSet<Long>() );
|
||||
target.setLongsInitialized( new LinkedHashSet<Long>() );
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -232,10 +232,10 @@ public class DomainDtoWithNvmsDefaultMapperImpl implements DomainDtoWithNvmsDefa
|
||||
|
||||
protected Set<Long> stringListToLongSet(List<String> list) {
|
||||
if ( list == null ) {
|
||||
return new HashSet<Long>();
|
||||
return new LinkedHashSet<Long>();
|
||||
}
|
||||
|
||||
Set<Long> set = new HashSet<Long>( Math.max( (int) ( list.size() / .75f ) + 1, 16 ) );
|
||||
Set<Long> set = new LinkedHashSet<Long>( Math.max( (int) ( list.size() / .75f ) + 1, 16 ) );
|
||||
for ( String string : list ) {
|
||||
set.add( Long.parseLong( string ) );
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
package org.mapstruct.ap.test.bugs._913;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Generated;
|
||||
@ -30,12 +30,12 @@ public class DomainDtoWithNvmsNullMapperImpl implements DomainDtoWithNvmsNullMap
|
||||
|
||||
List<String> list = source.getStrings();
|
||||
if ( list != null ) {
|
||||
domain.setStrings( new HashSet<String>( list ) );
|
||||
domain.setStrings( new LinkedHashSet<String>( list ) );
|
||||
}
|
||||
domain.setLongs( stringListToLongSet( source.getStrings() ) );
|
||||
List<String> list1 = source.getStringsInitialized();
|
||||
if ( list1 != null ) {
|
||||
domain.setStringsInitialized( new HashSet<String>( list1 ) );
|
||||
domain.setStringsInitialized( new LinkedHashSet<String>( list1 ) );
|
||||
}
|
||||
domain.setLongsInitialized( stringListToLongSet( source.getStringsInitialized() ) );
|
||||
List<String> list2 = source.getStringsWithDefault();
|
||||
@ -68,7 +68,7 @@ public class DomainDtoWithNvmsNullMapperImpl implements DomainDtoWithNvmsNullMap
|
||||
else {
|
||||
List<String> list = source.getStrings();
|
||||
if ( list != null ) {
|
||||
target.setStrings( new HashSet<String>( list ) );
|
||||
target.setStrings( new LinkedHashSet<String>( list ) );
|
||||
}
|
||||
}
|
||||
if ( target.getLongs() != null ) {
|
||||
@ -100,7 +100,7 @@ public class DomainDtoWithNvmsNullMapperImpl implements DomainDtoWithNvmsNullMap
|
||||
else {
|
||||
List<String> list1 = source.getStringsInitialized();
|
||||
if ( list1 != null ) {
|
||||
target.setStringsInitialized( new HashSet<String>( list1 ) );
|
||||
target.setStringsInitialized( new LinkedHashSet<String>( list1 ) );
|
||||
}
|
||||
}
|
||||
if ( target.getLongsInitialized() != null ) {
|
||||
@ -159,7 +159,7 @@ public class DomainDtoWithNvmsNullMapperImpl implements DomainDtoWithNvmsNullMap
|
||||
else {
|
||||
List<String> list = source.getStrings();
|
||||
if ( list != null ) {
|
||||
target.setStrings( new HashSet<String>( list ) );
|
||||
target.setStrings( new LinkedHashSet<String>( list ) );
|
||||
}
|
||||
}
|
||||
if ( target.getLongs() != null ) {
|
||||
@ -191,7 +191,7 @@ public class DomainDtoWithNvmsNullMapperImpl implements DomainDtoWithNvmsNullMap
|
||||
else {
|
||||
List<String> list1 = source.getStringsInitialized();
|
||||
if ( list1 != null ) {
|
||||
target.setStringsInitialized( new HashSet<String>( list1 ) );
|
||||
target.setStringsInitialized( new LinkedHashSet<String>( list1 ) );
|
||||
}
|
||||
}
|
||||
if ( target.getLongsInitialized() != null ) {
|
||||
@ -238,7 +238,7 @@ public class DomainDtoWithNvmsNullMapperImpl implements DomainDtoWithNvmsNullMap
|
||||
return null;
|
||||
}
|
||||
|
||||
Set<Long> set = new HashSet<Long>( Math.max( (int) ( list.size() / .75f ) + 1, 16 ) );
|
||||
Set<Long> set = new LinkedHashSet<Long>( Math.max( (int) ( list.size() / .75f ) + 1, 16 ) );
|
||||
for ( String string : list ) {
|
||||
set.add( Long.parseLong( string ) );
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
package org.mapstruct.ap.test.bugs._913;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Generated;
|
||||
@ -30,12 +30,12 @@ public class DomainDtoWithPresenceCheckMapperImpl implements DomainDtoWithPresen
|
||||
|
||||
if ( source.hasStrings() ) {
|
||||
List<String> list = source.getStrings();
|
||||
domain.setStrings( new HashSet<String>( list ) );
|
||||
domain.setStrings( new LinkedHashSet<String>( list ) );
|
||||
}
|
||||
domain.setLongs( stringListToLongSet( source.getStrings() ) );
|
||||
if ( source.hasStringsInitialized() ) {
|
||||
List<String> list1 = source.getStringsInitialized();
|
||||
domain.setStringsInitialized( new HashSet<String>( list1 ) );
|
||||
domain.setStringsInitialized( new LinkedHashSet<String>( list1 ) );
|
||||
}
|
||||
domain.setLongsInitialized( stringListToLongSet( source.getStringsInitialized() ) );
|
||||
if ( source.hasStringsWithDefault() ) {
|
||||
@ -64,7 +64,7 @@ public class DomainDtoWithPresenceCheckMapperImpl implements DomainDtoWithPresen
|
||||
else {
|
||||
if ( source.hasStrings() ) {
|
||||
List<String> list = source.getStrings();
|
||||
target.setStrings( new HashSet<String>( list ) );
|
||||
target.setStrings( new LinkedHashSet<String>( list ) );
|
||||
}
|
||||
}
|
||||
if ( target.getLongs() != null ) {
|
||||
@ -87,7 +87,7 @@ public class DomainDtoWithPresenceCheckMapperImpl implements DomainDtoWithPresen
|
||||
else {
|
||||
if ( source.hasStringsInitialized() ) {
|
||||
List<String> list1 = source.getStringsInitialized();
|
||||
target.setStringsInitialized( new HashSet<String>( list1 ) );
|
||||
target.setStringsInitialized( new LinkedHashSet<String>( list1 ) );
|
||||
}
|
||||
}
|
||||
if ( target.getLongsInitialized() != null ) {
|
||||
@ -136,7 +136,7 @@ public class DomainDtoWithPresenceCheckMapperImpl implements DomainDtoWithPresen
|
||||
else {
|
||||
if ( source.hasStrings() ) {
|
||||
List<String> list = source.getStrings();
|
||||
target.setStrings( new HashSet<String>( list ) );
|
||||
target.setStrings( new LinkedHashSet<String>( list ) );
|
||||
}
|
||||
}
|
||||
if ( target.getLongs() != null ) {
|
||||
@ -159,7 +159,7 @@ public class DomainDtoWithPresenceCheckMapperImpl implements DomainDtoWithPresen
|
||||
else {
|
||||
if ( source.hasStringsInitialized() ) {
|
||||
List<String> list1 = source.getStringsInitialized();
|
||||
target.setStringsInitialized( new HashSet<String>( list1 ) );
|
||||
target.setStringsInitialized( new LinkedHashSet<String>( list1 ) );
|
||||
}
|
||||
}
|
||||
if ( target.getLongsInitialized() != null ) {
|
||||
@ -200,7 +200,7 @@ public class DomainDtoWithPresenceCheckMapperImpl implements DomainDtoWithPresen
|
||||
return null;
|
||||
}
|
||||
|
||||
Set<Long> set = new HashSet<Long>( Math.max( (int) ( list.size() / .75f ) + 1, 16 ) );
|
||||
Set<Long> set = new LinkedHashSet<Long>( Math.max( (int) ( list.size() / .75f ) + 1, 16 ) );
|
||||
for ( String string : list ) {
|
||||
set.add( Long.parseLong( string ) );
|
||||
}
|
||||
|
@ -7,8 +7,8 @@ package org.mapstruct.ap.test.collection.defaultimplementation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.NavigableMap;
|
||||
@ -82,7 +82,7 @@ public class SourceTargetMapperImpl implements SourceTargetMapper {
|
||||
return null;
|
||||
}
|
||||
|
||||
Set<TargetFoo> set = new HashSet<TargetFoo>( Math.max( (int) ( foos.size() / .75f ) + 1, 16 ) );
|
||||
Set<TargetFoo> set = new LinkedHashSet<TargetFoo>( Math.max( (int) ( foos.size() / .75f ) + 1, 16 ) );
|
||||
for ( SourceFoo sourceFoo : foos ) {
|
||||
set.add( sourceFooToTargetFoo( sourceFoo ) );
|
||||
}
|
||||
@ -178,7 +178,7 @@ public class SourceTargetMapperImpl implements SourceTargetMapper {
|
||||
return null;
|
||||
}
|
||||
|
||||
Map<String, TargetFoo> map = new HashMap<String, TargetFoo>( Math.max( (int) ( foos.size() / .75f ) + 1, 16 ) );
|
||||
Map<String, TargetFoo> map = new LinkedHashMap<String, TargetFoo>( Math.max( (int) ( foos.size() / .75f ) + 1, 16 ) );
|
||||
|
||||
for ( java.util.Map.Entry<Long, SourceFoo> entry : foos.entrySet() ) {
|
||||
String key = String.valueOf( entry.getKey() );
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package org.mapstruct.ap.test.updatemethods;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
@ -83,7 +83,7 @@ public class CompanyMapper1Impl implements CompanyMapper1 {
|
||||
return null;
|
||||
}
|
||||
|
||||
Map<SecretaryEntity, EmployeeEntity> map1 = new HashMap<SecretaryEntity, EmployeeEntity>( Math.max( (int) ( map.size() / .75f ) + 1, 16 ) );
|
||||
Map<SecretaryEntity, EmployeeEntity> map1 = new LinkedHashMap<SecretaryEntity, EmployeeEntity>( Math.max( (int) ( map.size() / .75f ) + 1, 16 ) );
|
||||
|
||||
for ( java.util.Map.Entry<SecretaryDto, EmployeeDto> entry : map.entrySet() ) {
|
||||
SecretaryEntity key = secretaryDtoToSecretaryEntity( entry.getKey() );
|
||||
|
@ -6,7 +6,7 @@
|
||||
package org.mapstruct.ap.test.updatemethods.selection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import javax.annotation.Generated;
|
||||
import org.mapstruct.ap.test.updatemethods.DepartmentDto;
|
||||
import org.mapstruct.ap.test.updatemethods.DepartmentEntity;
|
||||
@ -42,7 +42,7 @@ public class DepartmentMapperImpl implements DepartmentMapper {
|
||||
}
|
||||
if ( dto.getSecretaryToEmployee() != null ) {
|
||||
if ( entity.getSecretaryToEmployee() == null ) {
|
||||
entity.setSecretaryToEmployee( new HashMap<SecretaryEntity, EmployeeEntity>() );
|
||||
entity.setSecretaryToEmployee( new LinkedHashMap<SecretaryEntity, EmployeeEntity>() );
|
||||
}
|
||||
externalHandWrittenMapper.toSecretaryEmployeeEntityMap( dto.getSecretaryToEmployee(), entity.getSecretaryToEmployee() );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user