Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
Expand Down Expand Up @@ -371,11 +370,8 @@ private void sortPropertyMappingsByDependencies() {
);
}
else {
Collections.sort(
propertyMappings,
Comparator.comparingInt( propertyMapping ->
graphAnalyzer.getTraversalSequence( propertyMapping.getName() ) )
);
propertyMappings.sort( Comparator.comparingInt( propertyMapping ->
graphAnalyzer.getTraversalSequence( propertyMapping.getName() ) ) );
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,11 @@ public String getTargetVariableName() {

@Override
public Set<Type> getImportTypes() {
return declaringType != null ? Collections.asSet( declaringType ) : java.util.Collections.<Type> emptySet();
return declaringType != null ? Collections.asSet( declaringType ) : java.util.Collections.emptySet();
}

public boolean hasMappingTargetParameter() {
for ( ParameterBinding param : getParameterBindings() ) {
if ( param.isMappingTarget() ) {
return true;
}
}

return false;
return getParameterBindings().stream().anyMatch( ParameterBinding::isMappingTarget );
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static MethodReference getFactoryMethod( Method method,
selectors.getMatchingMethods(
method,
getAllAvailableMethods( method, ctx.getSourceModel() ),
java.util.Collections.<Type> emptyList(),
java.util.Collections.emptyList(),
alternativeTarget,
SelectionCriteria.forFactoryMethods( selectionParameters ) );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
public class ParameterProvidedMethods {
private static final ParameterProvidedMethods EMPTY =
new ParameterProvidedMethods( Collections.<Parameter, List<SourceMethod>> emptyMap() );
new ParameterProvidedMethods( Collections.emptyMap() );

private final Map<Parameter, List<SourceMethod>> parameterToProvidedMethods;
private final Map<SourceMethod, Parameter> methodToProvidingParameter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,13 +454,7 @@ public boolean matches(List<Type> sourceTypes, Type targetType) {
* @return {@code true} if the parameter list contains a parameter annotated with {@code @TargetType}
*/
public static boolean containsTargetTypeParameter(List<Parameter> parameters) {
for ( Parameter param : parameters ) {
if ( param.isTargetType() ) {
return true;
}
}

return false;
return parameters.stream().anyMatch( Parameter::isTargetType );
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
package org.mapstruct.ap.internal.util.workarounds;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
Expand Down Expand Up @@ -73,7 +72,7 @@ static TypeMirror asMemberOf(ProcessingEnvironment environment, DeclaredType con
candidatesFromInterfaces );

// there can be multiple matches for the same method name from adjacent interface hierarchies.
Collections.sort( candidatesFromInterfaces, MostSpecificMethodBindingComparator.INSTANCE );
candidatesFromInterfaces.sort( MostSpecificMethodBindingComparator.INSTANCE );

if ( !candidatesFromInterfaces.isEmpty() ) {
// return the most specific match
Expand Down