Closes #2521 - Fix code smells Stream.collect(Collectors.toList()) to Stream.toList()
This commit is contained in:
parent
7425e55906
commit
9304fdedd9
|
|
@ -11,7 +11,6 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
import org.springframework.beans.BeanInstantiationException;
|
import org.springframework.beans.BeanInstantiationException;
|
||||||
import org.springframework.beans.TypeMismatchException;
|
import org.springframework.beans.TypeMismatchException;
|
||||||
|
|
@ -220,13 +219,13 @@ public class TaskanaRestExceptionHandler extends ResponseEntityExceptionHandler
|
||||||
Arrays.stream(targetType.getEnumConstants())
|
Arrays.stream(targetType.getEnumConstants())
|
||||||
.map(Enum.class::cast)
|
.map(Enum.class::cast)
|
||||||
.map(Enum::name)
|
.map(Enum::name)
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
Set<String> enumConstantSet = new HashSet<>(enumConstants);
|
Set<String> enumConstantSet = new HashSet<>(enumConstants);
|
||||||
|
|
||||||
return getRejectedValues(typeMismatchException)
|
return getRejectedValues(typeMismatchException)
|
||||||
.filter(not(enumConstantSet::contains))
|
.filter(not(enumConstantSet::contains))
|
||||||
.map(value -> new MalformedQueryParameter(queryParameter, value, enumConstants))
|
.map(value -> new MalformedQueryParameter(queryParameter, value, enumConstants))
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue