Rather than checking size() == 0, use isEmpty(), which is clearer
and potentially fasterUse a simple isEmpty() check
Rather than checking size() == 0, use isEmpty(), which is clearer
and potentially faster.
Change-Id: I0aadff4a55258f2fbb0bd60c26993b08b3b8e7b0
Signed-off-by: Robert Varga <[email protected]>
final Set<MediaType> acceptableAndSupportedMediaTypes = headers.getAcceptableMediaTypes().stream()
.filter(RestconfDocumentedExceptionMapper::isCompatibleMediaType)
.collect(Collectors.toSet());
- if (acceptableAndSupportedMediaTypes.size() == 0) {
+ if (acceptableAndSupportedMediaTypes.isEmpty()) {
// check content type of the request
final MediaType requestMediaType = headers.getMediaType();
return requestMediaType == null ? DEFAULT_MEDIA_TYPE