Use Set.of() in StringToBooleanConverter
This commit is contained in:
parent
613aac5009
commit
d533eb4a55
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2020 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.
|
||||
|
@ -16,36 +16,24 @@
|
|||
|
||||
package org.springframework.core.convert.support;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Converts String to a Boolean.
|
||||
* Converts a String to a Boolean.
|
||||
*
|
||||
* @author Keith Donald
|
||||
* @author Juergen Hoeller
|
||||
* @author Sam Brannen
|
||||
* @since 3.0
|
||||
*/
|
||||
final class StringToBooleanConverter implements Converter<String, Boolean> {
|
||||
|
||||
private static final Set<String> trueValues = new HashSet<>(8);
|
||||
private static final Set<String> trueValues = Set.of("true", "on", "yes", "1");
|
||||
|
||||
private static final Set<String> falseValues = new HashSet<>(8);
|
||||
|
||||
static {
|
||||
trueValues.add("true");
|
||||
trueValues.add("on");
|
||||
trueValues.add("yes");
|
||||
trueValues.add("1");
|
||||
|
||||
falseValues.add("false");
|
||||
falseValues.add("off");
|
||||
falseValues.add("no");
|
||||
falseValues.add("0");
|
||||
}
|
||||
private static final Set<String> falseValues = Set.of("false", "off", "no", "0");
|
||||
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue