Use new Java features (switch expressions, text blocks, new JDK methods)
Closes gh-29747
This commit is contained in:
committed by
Sam Brannen
parent
48abd493fe
commit
afb8a0d1b1
@@ -381,8 +381,7 @@ class ReactiveTypeHandler {
|
||||
|
||||
@Override
|
||||
protected void send(Object element) throws IOException {
|
||||
if (element instanceof ServerSentEvent) {
|
||||
ServerSentEvent<?> event = (ServerSentEvent<?>) element;
|
||||
if (element instanceof ServerSentEvent<?> event) {
|
||||
((SseEmitter) getEmitter()).send(adapt(event));
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -223,16 +223,14 @@ public abstract class AbstractMultiCheckedElementTag extends AbstractCheckedElem
|
||||
writeObjectEntry(tagWriter, valueProperty, labelProperty, item, i);
|
||||
}
|
||||
}
|
||||
else if (itemsObject instanceof Collection) {
|
||||
final Collection<?> optionCollection = (Collection<?>) itemsObject;
|
||||
else if (itemsObject instanceof final Collection<?> optionCollection) {
|
||||
int itemIndex = 0;
|
||||
for (Iterator<?> it = optionCollection.iterator(); it.hasNext(); itemIndex++) {
|
||||
Object item = it.next();
|
||||
writeObjectEntry(tagWriter, valueProperty, labelProperty, item, itemIndex);
|
||||
}
|
||||
}
|
||||
else if (itemsObject instanceof Map) {
|
||||
final Map<?, ?> optionMap = (Map<?, ?>) itemsObject;
|
||||
else if (itemsObject instanceof final Map<?, ?> optionMap) {
|
||||
int itemIndex = 0;
|
||||
for (Iterator it = optionMap.entrySet().iterator(); it.hasNext(); itemIndex++) {
|
||||
Map.Entry entry = (Map.Entry) it.next();
|
||||
|
||||
@@ -537,8 +537,7 @@ public class RedirectView extends AbstractUrlBasedView implements SmartView {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (value instanceof Collection) {
|
||||
Collection<?> coll = (Collection<?>) value;
|
||||
if (value instanceof Collection<?> coll) {
|
||||
if (coll.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user