提交 1f3b595a 编写于 作者: S stsypanov 提交者: Juergen Hoeller

Use String.isEmpty() instead of String.equals("")

上级 bb2e3ce6
......@@ -56,7 +56,7 @@ public class AnnotationBeanWiringInfoResolver implements BeanWiringInfoResolver
// Autowiring by name or by type
return new BeanWiringInfo(annotation.autowire().value(), annotation.dependencyCheck());
}
else if (!"".equals(annotation.value())) {
else if (!annotation.value().isEmpty()) {
// Explicitly specified bean name for bean definition to take property values from
return new BeanWiringInfo(annotation.value(), false);
}
......
......@@ -126,7 +126,7 @@ public class SimpleNamingContext implements Context {
if (logger.isDebugEnabled()) {
logger.debug("Static JNDI lookup: [" + name + "]");
}
if ("".equals(name)) {
if (name.isEmpty()) {
return new SimpleNamingContext(this.root, this.boundObjects, this.environment);
}
Object found = this.boundObjects.get(name);
......@@ -306,7 +306,7 @@ public class SimpleNamingContext implements Context {
private Iterator<T> iterator;
private AbstractNamingEnumeration(SimpleNamingContext context, String proot) throws NamingException {
if (!"".equals(proot) && !proot.endsWith("/")) {
if (!proot.isEmpty() && !proot.endsWith("/")) {
proot = proot + "/";
}
String root = context.root + proot;
......
......@@ -105,7 +105,7 @@ public class ServerSentEventHttpMessageReader implements HttpMessageReader<Objec
ResolvableType valueType = (shouldWrap ? elementType.getGeneric() : elementType);
return stringDecoder.decode(message.getBody(), STRING_TYPE, null, hints)
.bufferUntil(line -> line.equals(""))
.bufferUntil(String::isEmpty)
.concatMap(lines -> Mono.justOrEmpty(buildEvent(lines, valueType, shouldWrap, hints)));
}
......
......@@ -97,7 +97,7 @@ final class DefaultPathContainer implements PathContainer {
static PathContainer createFromUrlPath(String path, Options options) {
if (path.equals("")) {
if (path.isEmpty()) {
return EMPTY_PATH;
}
char separator = options.separator();
......@@ -117,7 +117,7 @@ final class DefaultPathContainer implements PathContainer {
while (begin < path.length()) {
int end = path.indexOf(separator, begin);
String segment = (end != -1 ? path.substring(begin, end) : path.substring(begin));
if (!segment.equals("")) {
if (!segment.isEmpty()) {
elements.add(options.shouldDecodeAndParseSegments() ?
decodeAndParsePathSegment(segment) :
new DefaultPathSegment(segment, separatorElement));
......
......@@ -411,8 +411,8 @@ public class PathPattern implements Comparable<PathPattern> {
int dotPos2 = p2string.indexOf('.');
String file2 = (dotPos2 == -1 ? p2string : p2string.substring(0, dotPos2));
String secondExtension = (dotPos2 == -1 ? "" : p2string.substring(dotPos2));
boolean firstExtensionWild = (firstExtension.equals(".*") || firstExtension.equals(""));
boolean secondExtensionWild = (secondExtension.equals(".*") || secondExtension.equals(""));
boolean firstExtensionWild = (firstExtension.equals(".*") || firstExtension.isEmpty());
boolean secondExtensionWild = (secondExtension.equals(".*") || secondExtension.isEmpty());
if (!firstExtensionWild && !secondExtensionWild) {
throw new IllegalArgumentException(
"Cannot combine patterns: " + this.patternString + " and " + pattern2string);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册