This commit is contained in:
Looly 2023-04-12 01:18:11 +08:00
parent bc601ca0ad
commit d2e5155ac5
205 changed files with 500 additions and 492 deletions

View File

@ -61,7 +61,7 @@ public class Hutool {
*/
public static Set<Class<?>> getAllUtils() {
return ClassUtil.scanPackage("org.dromara.hutool",
(clazz) -> (false == clazz.isInterface()) && StrUtil.endWith(clazz.getSimpleName(), "Util"));
(clazz) -> (! clazz.isInterface()) && StrUtil.endWith(clazz.getSimpleName(), "Util"));
}
/**

View File

@ -62,7 +62,7 @@ public class AnnotationProxy<T extends Annotation> implements Annotation, Invoca
if(null != alias){
final String name = alias.value();
if(StrUtil.isNotBlank(name)){
if(false == attributes.containsKey(name)){
if(! attributes.containsKey(name)){
throw new IllegalArgumentException(StrUtil.format("No method for alias: [{}]", name));
}
return attributes.get(name);

View File

@ -253,9 +253,9 @@ public class AnnotationUtil {
// 只读取无参方法
final String name = t.getName();
// 跳过自有的几个方法
return (false == "hashCode".equals(name)) //
&& (false == "toString".equals(name)) //
&& (false == "annotationType".equals(name));
return (! "hashCode".equals(name)) //
&& (! "toString".equals(name)) //
&& (! "annotationType".equals(name));
}
return false;
});
@ -360,6 +360,9 @@ public class AnnotationUtil {
@SuppressWarnings("unchecked")
public static <T extends Annotation> T getAnnotationAlias(final AnnotatedElement annotationEle, final Class<T> annotationType) {
final T annotation = getAnnotation(annotationEle, annotationType);
if (null == annotation) {
return null;
}
return (T) Proxy.newProxyInstance(annotationType.getClassLoader(), new Class[]{annotationType}, new AnnotationProxy<>(annotation));
}

View File

@ -146,9 +146,9 @@ public class CombinationAnnotationElement implements AnnotatedElement, Serializa
// 直接注解
for (final Annotation annotation : annotations) {
annotationType = annotation.annotationType();
if (false == META_ANNOTATIONS.contains(annotationType)
if (! META_ANNOTATIONS.contains(annotationType)
// issue#I5FQGW@Gitee跳过元注解和已经处理过的注解防止递归调用
&& false == declaredAnnotationMap.containsKey(annotationType)) {
&& ! declaredAnnotationMap.containsKey(annotationType)) {
if(test(annotation)){
declaredAnnotationMap.put(annotationType, annotation);
}
@ -167,9 +167,9 @@ public class CombinationAnnotationElement implements AnnotatedElement, Serializa
Class<? extends Annotation> annotationType;
for (final Annotation annotation : annotations) {
annotationType = annotation.annotationType();
if (false == META_ANNOTATIONS.contains(annotationType)
if (! META_ANNOTATIONS.contains(annotationType)
// issue#I5FQGW@Gitee跳过元注解和已经处理过的注解防止递归调用
&& false == declaredAnnotationMap.containsKey(annotationType)) {
&& ! declaredAnnotationMap.containsKey(annotationType)) {
if(test(annotation)){
annotationMap.put(annotationType, annotation);
}

View File

@ -155,7 +155,7 @@ public class ArrayUtil extends PrimitiveArrayUtil {
* @return 是否为非空
*/
public static <T> boolean isNotEmpty(final T[] array) {
return (null != array && array.length != 0);
return !isEmpty(array);
}
/**
@ -168,7 +168,7 @@ public class ArrayUtil extends PrimitiveArrayUtil {
* @return 是否为非空
*/
public static boolean isNotEmpty(final Object array) {
return false == isEmpty(array);
return !isEmpty(array);
}
/**
@ -379,7 +379,7 @@ public class ArrayUtil extends PrimitiveArrayUtil {
if (null == arrayObj) {
throw new NullPointerException("Argument [arrayObj] is null !");
}
if (false == arrayObj.getClass().isArray()) {
if (! arrayObj.getClass().isArray()) {
throw new IllegalArgumentException("Argument [arrayObj] is not array !");
}
if (null == type) {
@ -1015,7 +1015,7 @@ public class ArrayUtil extends PrimitiveArrayUtil {
@SuppressWarnings("unchecked")
public static <T> boolean containsAll(final T[] array, final T... values) {
for (final T value : values) {
if (false == contains(array, value)) {
if (! contains(array, value)) {
return false;
}
}
@ -1313,7 +1313,7 @@ public class ArrayUtil extends PrimitiveArrayUtil {
if (null == array) {
return null;
}
if (false == isArray(array)) {
if (! isArray(array)) {
throw new IllegalArgumentException(StrUtil.format("[{}] is not a Array!", array.getClass()));
}
@ -1593,7 +1593,7 @@ public class ArrayUtil extends PrimitiveArrayUtil {
*/
public static <T> boolean isAllEmpty(final T[] args) {
for (final T obj : args) {
if (false == ObjUtil.isEmpty(obj)) {
if (! ObjUtil.isEmpty(obj)) {
return false;
}
}
@ -1609,7 +1609,7 @@ public class ArrayUtil extends PrimitiveArrayUtil {
* @since 4.5.18
*/
public static boolean isAllNotEmpty(final Object... args) {
return false == hasEmpty(args);
return ! hasEmpty(args);
}
/**
@ -1623,7 +1623,7 @@ public class ArrayUtil extends PrimitiveArrayUtil {
*/
@SuppressWarnings("unchecked")
public static <T> boolean isAllNotNull(final T... array) {
return false == hasNull(array);
return ! hasNull(array);
}
/**
@ -1829,7 +1829,7 @@ public class ArrayUtil extends PrimitiveArrayUtil {
}
for (int i = 0; i < subArray.length; i++) {
if (false == ObjUtil.equals(array[i + firstIndex], subArray[i])) {
if (! ObjUtil.equals(array[i + firstIndex], subArray[i])) {
return indexOfSub(array, firstIndex + 1, subArray);
}
}
@ -1874,7 +1874,7 @@ public class ArrayUtil extends PrimitiveArrayUtil {
}
for (int i = 0; i < subArray.length; i++) {
if (false == ObjUtil.equals(array[i + firstIndex], subArray[i])) {
if (! ObjUtil.equals(array[i + firstIndex], subArray[i])) {
return lastIndexOfSub(array, firstIndex - 1, subArray);
}
}

View File

@ -55,7 +55,7 @@ public class ArrayWrapper<A> implements Wrapper<A> {
*/
public ArrayWrapper(final A array) {
Assert.notNull(array, "Array must be not null!");
if (false == ArrayUtil.isArray(array)) {
if (! ArrayUtil.isArray(array)) {
throw new IllegalArgumentException("Object is not a array!");
}
this.componentType = array.getClass().getComponentType();
@ -301,7 +301,7 @@ public class ArrayWrapper<A> implements Wrapper<A> {
*/
@SuppressWarnings({"unchecked", "SuspiciousSystemArraycopy"})
public ArrayWrapper<A> insert(int index, Object arrayToAppend) {
if (false == ArrayUtil.isArray(arrayToAppend)) {
if (! ArrayUtil.isArray(arrayToAppend)) {
// 用户传入单个元素则创建单元素数组
arrayToAppend = createSingleElementArray(arrayToAppend);
}
@ -355,7 +355,7 @@ public class ArrayWrapper<A> implements Wrapper<A> {
*/
@SuppressWarnings({"unchecked", "SuspiciousSystemArraycopy"})
public ArrayWrapper<A> replace(final int index, Object values) {
if (false == ArrayUtil.isArray(values)) {
if (! ArrayUtil.isArray(values)) {
// 用户传入单个元素则创建单元素数组
values = createSingleElementArray(values);
}
@ -537,7 +537,7 @@ public class ArrayWrapper<A> implements Wrapper<A> {
for (int i = 0; i < this.length; i++) {
compare = comparator.compare(get(i), get(i + 1));
if ((isDESC && compare < 0) ||
(false == isDESC && compare > 0)) {
(! isDESC && compare > 0)) {
// 反序前一个小于后一个则返回错
// 正序前一个大于后一个则返回错
return false;

View File

@ -124,7 +124,7 @@ public class PrimitiveArrayUtil {
* @return 是否为非空
*/
public static boolean isNotEmpty(final long[] array) {
return false == isEmpty(array);
return !isEmpty(array);
}
/**
@ -134,7 +134,7 @@ public class PrimitiveArrayUtil {
* @return 是否为非空
*/
public static boolean isNotEmpty(final int[] array) {
return false == isEmpty(array);
return !isEmpty(array);
}
/**
@ -144,7 +144,7 @@ public class PrimitiveArrayUtil {
* @return 是否为非空
*/
public static boolean isNotEmpty(final short[] array) {
return false == isEmpty(array);
return !isEmpty(array);
}
/**
@ -154,7 +154,7 @@ public class PrimitiveArrayUtil {
* @return 是否为非空
*/
public static boolean isNotEmpty(final char[] array) {
return false == isEmpty(array);
return !isEmpty(array);
}
/**
@ -164,7 +164,7 @@ public class PrimitiveArrayUtil {
* @return 是否为非空
*/
public static boolean isNotEmpty(final byte[] array) {
return false == isEmpty(array);
return !isEmpty(array);
}
/**
@ -174,7 +174,7 @@ public class PrimitiveArrayUtil {
* @return 是否为非空
*/
public static boolean isNotEmpty(final double[] array) {
return false == isEmpty(array);
return !isEmpty(array);
}
/**
@ -184,7 +184,7 @@ public class PrimitiveArrayUtil {
* @return 是否为非空
*/
public static boolean isNotEmpty(final float[] array) {
return false == isEmpty(array);
return !isEmpty(array);
}
/**
@ -194,7 +194,7 @@ public class PrimitiveArrayUtil {
* @return 是否为非空
*/
public static boolean isNotEmpty(final boolean[] array) {
return false == isEmpty(array);
return !isEmpty(array);
}
// endregion

View File

@ -156,7 +156,7 @@ public class BeanDesc implements Serializable {
PropDesc prop;
for (final Field field : FieldUtil.getFields(this.beanClass)) {
// 排除静态属性和对象子类
if (false == ModifierUtil.isStatic(field) && false == FieldUtil.isOuterClassField(field)) {
if (! ModifierUtil.isStatic(field) && ! FieldUtil.isOuterClassField(field)) {
prop = createProp(field, gettersAndSetters);
// 只有不存在时才放入防止父类属性覆盖子类属性
this.propMap.putIfAbsent(prop.getFieldName(), prop);
@ -314,7 +314,7 @@ public class BeanDesc implements Serializable {
}
// 非标准Setter方法跳过
if (false == methodName.startsWith("set")) {
if (! methodName.startsWith("set")) {
return false;
}

View File

@ -143,7 +143,7 @@ public class BeanPath implements Serializable {
subBean = getFieldValue(subBean, patternPart);
if (null == subBean) {
// 支持表达式的第一个对象为Bean本身若用户定义表达式$开头则不做此操作
if (isFirst && false == this.isStartWith && BeanUtil.isMatchName(bean, patternPart, true)) {
if (isFirst && ! this.isStartWith && BeanUtil.isMatchName(bean, patternPart, true)) {
subBean = bean;
isFirst = false;
} else {
@ -186,7 +186,7 @@ public class BeanPath implements Serializable {
subBean = getFieldValue(subBean, patternPart);
if (null == subBean) {
// 支持表达式的第一个对象为Bean本身若用户定义表达式$开头则不做此操作
if (isFirst && false == this.isStartWith && BeanUtil.isMatchName(bean, patternPart, true)) {
if (isFirst && ! this.isStartWith && BeanUtil.isMatchName(bean, patternPart, true)) {
subBean = bean;
isFirst = false;
} else {
@ -268,15 +268,15 @@ public class BeanPath implements Serializable {
if ('\'' == c) {
// 结束
isInWrap = (false == isInWrap);
isInWrap = (! isInWrap);
continue;
}
if (false == isInWrap && ArrayUtil.contains(EXP_CHARS, c)) {
if (! isInWrap && ArrayUtil.contains(EXP_CHARS, c)) {
// 处理边界符号
if (CharUtil.BRACKET_END == c) {
// 中括号数字下标结束
if (false == isNumStart) {
if (! isNumStart) {
throw new IllegalArgumentException(StrUtil.format("Bad expression '{}':{}, we find ']' but no '[' !", expression, i));
}
isNumStart = false;

View File

@ -130,7 +130,7 @@ public class BeanUtil {
if (method.getParameterCount() == 0) {
final String name = method.getName();
if (name.startsWith("get") || name.startsWith("is")) {
if (false == "getClass".equals(name)) {
if (! "getClass".equals(name)) {
return true;
}
}
@ -150,7 +150,7 @@ public class BeanUtil {
public static boolean hasPublicField(final Class<?> clazz) {
if (ClassUtil.isNormalClass(clazz)) {
for (final Field field : clazz.getFields()) {
if (ModifierUtil.isPublic(field) && false == ModifierUtil.isStatic(field)) {
if (ModifierUtil.isPublic(field) && ! ModifierUtil.isStatic(field)) {
//非static的public字段
return true;
}
@ -220,7 +220,7 @@ public class BeanUtil {
}
return ArrayUtil.filter(beanInfo.getPropertyDescriptors(), t -> {
// 过滤掉getClass方法
return false == "class".equals(t.getName());
return ! "class".equals(t.getName());
});
}
@ -821,7 +821,7 @@ public class BeanUtil {
final String val = (String) FieldUtil.getFieldValue(bean, field);
if (null != val) {
final String trimVal = StrUtil.trim(val);
if (false == val.equals(trimVal)) {
if (! val.equals(trimVal)) {
// Field Value不为null且首尾有空格才处理
FieldUtil.setFieldValue(bean, field, trimVal);
}
@ -840,7 +840,7 @@ public class BeanUtil {
* @since 5.0.7
*/
public static boolean isNotEmpty(final Object bean, final String... ignoreFieldNames) {
return false == isEmpty(bean, ignoreFieldNames);
return !isEmpty(bean, ignoreFieldNames);
}
/**
@ -858,7 +858,7 @@ public class BeanUtil {
if (ModifierUtil.isStatic(field)) {
continue;
}
if ((false == ArrayUtil.contains(ignoreFieldNames, field.getName()))
if ((! ArrayUtil.contains(ignoreFieldNames, field.getName()))
&& null != FieldUtil.getFieldValue(bean, field)) {
return false;
}
@ -884,7 +884,7 @@ public class BeanUtil {
if (ModifierUtil.isStatic(field)) {
continue;
}
if ((false == ArrayUtil.contains(ignoreFieldNames, field.getName()))
if ((! ArrayUtil.contains(ignoreFieldNames, field.getName()))
&& null == FieldUtil.getFieldValue(bean, field)) {
return true;
}

View File

@ -141,7 +141,7 @@ public class PropDesc {
*/
public boolean isReadable(final boolean checkTransient) {
// 检查是否有getter方法或是否为public修饰
if (null == this.getter && false == ModifierUtil.isPublic(this.field)) {
if (null == this.getter && ! ModifierUtil.isPublic(this.field)) {
return false;
}
@ -151,7 +151,7 @@ public class PropDesc {
}
// 检查@PropIgnore注解
return false == isIgnoreGet();
return ! isIgnoreGet();
}
/**
@ -189,7 +189,7 @@ public class PropDesc {
try {
result = getValue(bean);
} catch (final Exception e) {
if (false == ignoreError) {
if (! ignoreError) {
throw new BeanException(e, "Get value of [{}] error!", getFieldName());
}
}
@ -212,7 +212,7 @@ public class PropDesc {
*/
public boolean isWritable(final boolean checkTransient) {
// 检查是否有getter方法或是否为public修饰
if (null == this.setter && false == ModifierUtil.isPublic(this.field)) {
if (null == this.setter && ! ModifierUtil.isPublic(this.field)) {
return false;
}
@ -222,7 +222,7 @@ public class PropDesc {
}
// 检查@PropIgnore注解
return false == isIgnoreSet();
return ! isIgnoreSet();
}
/**
@ -277,24 +277,24 @@ public class PropDesc {
// issue#I4JQ1N@Gitee
// 非覆盖模式下如果目标值存在则跳过
if (false == override && null != getValue(bean)) {
if (! override && null != getValue(bean)) {
return this;
}
// 当类型不匹配的时候执行默认转换
if (null != value) {
final Class<?> propClass = getFieldClass();
if (false == propClass.isInstance(value)) {
if (! propClass.isInstance(value)) {
value = Convert.convertWithCheck(propClass, value, null, ignoreError);
}
}
// 属性赋值
if (null != value || false == ignoreNull) {
if (null != value || ! ignoreNull) {
try {
this.setValue(bean, value);
} catch (final Exception e) {
if (false == ignoreError) {
if (! ignoreError) {
throw new BeanException(e, "Set value of [{}] error!", getFieldName());
}
// 忽略注入失败
@ -382,11 +382,11 @@ public class PropDesc {
boolean isTransient = ModifierUtil.hasModifier(this.field, ModifierUtil.ModifierType.TRANSIENT);
// 检查Getter方法
if (false == isTransient && null != this.getter) {
if (! isTransient && null != this.getter) {
isTransient = ModifierUtil.hasModifier(this.getter, ModifierUtil.ModifierType.TRANSIENT);
// 检查注解
if (false == isTransient) {
if (! isTransient) {
isTransient = AnnotationUtil.hasAnnotation(this.getter, Transient.class);
}
}
@ -404,11 +404,11 @@ public class PropDesc {
boolean isTransient = ModifierUtil.hasModifier(this.field, ModifierUtil.ModifierType.TRANSIENT);
// 检查Getter方法
if (false == isTransient && null != this.setter) {
if (! isTransient && null != this.setter) {
isTransient = ModifierUtil.hasModifier(this.setter, ModifierUtil.ModifierType.TRANSIENT);
// 检查注解
if (false == isTransient) {
if (! isTransient) {
isTransient = AnnotationUtil.hasAnnotation(this.setter, Transient.class);
}
}

View File

@ -61,14 +61,14 @@ public class BeanToBeanCopier<S, T> extends AbsCopier<S, T> {
final Map<String, PropDesc> sourcePropDescMap = BeanUtil.getBeanDesc(source.getClass()).getPropMap(copyOptions.ignoreCase);
sourcePropDescMap.forEach((sFieldName, sDesc) -> {
if (null == sFieldName || false == sDesc.isReadable(copyOptions.transientSupport)) {
if (null == sFieldName || ! sDesc.isReadable(copyOptions.transientSupport)) {
// 字段空或不可读跳过
return;
}
// 检查源对象属性是否过滤属性
Object sValue = sDesc.getValue(this.source);
if (false == copyOptions.testPropertyFilter(sDesc.getField(), sValue)) {
if (! copyOptions.testPropertyFilter(sDesc.getField(), sValue)) {
return;
}
@ -87,7 +87,7 @@ public class BeanToBeanCopier<S, T> extends AbsCopier<S, T> {
// 检查目标字段可写性
// 目标字段检查放在键值对编辑之后因为键可能被编辑修改
final PropDesc tDesc = targetPropDescMap.get(sFieldName);
if (null == tDesc || false == tDesc.isWritable(this.copyOptions.transientSupport)) {
if (null == tDesc || ! tDesc.isWritable(this.copyOptions.transientSupport)) {
// 字段不可写跳过之
return;
}

View File

@ -60,14 +60,14 @@ public class BeanToMapCopier extends AbsCopier<Object, Map> {
final Map<String, PropDesc> sourcePropDescMap = BeanUtil.getBeanDesc(actualEditable).getPropMap(copyOptions.ignoreCase);
sourcePropDescMap.forEach((sFieldName, sDesc) -> {
if (null == sFieldName || false == sDesc.isReadable(copyOptions.transientSupport)) {
if (null == sFieldName || ! sDesc.isReadable(copyOptions.transientSupport)) {
// 字段空或不可读跳过
return;
}
// 检查源对象属性是否过滤属性
Object sValue = sDesc.getValue(this.source);
if (false == copyOptions.testPropertyFilter(sDesc.getField(), sValue)) {
if (! copyOptions.testPropertyFilter(sDesc.getField(), sValue)) {
return;
}
@ -91,7 +91,7 @@ public class BeanToMapCopier extends AbsCopier<Object, Map> {
}
// 目标赋值
if(null != sValue || false == copyOptions.ignoreNullValue){
if(null != sValue || ! copyOptions.ignoreNullValue){
target.put(sFieldName, sValue);
}
});

View File

@ -177,7 +177,7 @@ public class CopyOptions implements Serializable {
* @return CopyOptions
*/
public CopyOptions setIgnoreProperties(final String... ignoreProperties) {
return setPropertiesFilter((field, o) -> false == ArrayUtil.contains(ignoreProperties, field.getName()));
return setPropertiesFilter((field, o) -> ! ArrayUtil.contains(ignoreProperties, field.getName()));
}
/**
@ -192,7 +192,7 @@ public class CopyOptions implements Serializable {
@SuppressWarnings("unchecked")
public <P, R> CopyOptions setIgnoreProperties(final SerFunction<P, R>... funcs) {
final Set<String> ignoreProperties = ArrayUtil.mapToSet(funcs, LambdaUtil::getFieldName);
return setPropertiesFilter((field, o) -> false == ignoreProperties.contains(field.getName()));
return setPropertiesFilter((field, o) -> ! ignoreProperties.contains(field.getName()));
}
/**

View File

@ -89,14 +89,14 @@ public class MapToBeanCopier<T> extends AbsCopier<Map<?, ?>, T> {
// 检查目标字段可写性
// 目标字段检查放在键值对编辑之后因为键可能被编辑修改
final PropDesc tDesc = findPropDesc(targetPropDescMap, sFieldName);
if (null == tDesc || false == tDesc.isWritable(this.copyOptions.transientSupport)) {
if (null == tDesc || ! tDesc.isWritable(this.copyOptions.transientSupport)) {
// 字段不可写跳过之
return;
}
Object newValue = entry.getValue();
// 检查目标是否过滤属性
if (false == copyOptions.testPropertyFilter(tDesc.getField(), newValue)) {
if (! copyOptions.testPropertyFilter(tDesc.getField(), newValue)) {
return;
}

View File

@ -69,7 +69,7 @@ public class MapToMapCopier extends AbsCopier<Map, Map> {
final Object targetValue = target.get(sKey);
// 非覆盖模式下如果目标值存在则跳过
if (false == copyOptions.override && null != targetValue) {
if (! copyOptions.override && null != targetValue) {
return;
}

View File

@ -64,7 +64,7 @@ public class ValueProviderToBeanCopier<T> extends AbsCopier<ValueProvider<String
}
// 检查目标字段可写性
if (null == tDesc || false == tDesc.isWritable(this.copyOptions.transientSupport)) {
if (null == tDesc || ! tDesc.isWritable(this.copyOptions.transientSupport)) {
// 字段不可写跳过之
return;
}
@ -82,13 +82,13 @@ public class ValueProviderToBeanCopier<T> extends AbsCopier<ValueProvider<String
return;
}
// 无字段内容跳过
if(false == source.containsKey(tFieldName)){
if(! source.containsKey(tFieldName)){
return;
}
final Object sValue = source.value(tFieldName, fieldType);
// 检查目标对象属性是否过滤属性
if (false == copyOptions.testPropertyFilter(tDesc.getField(), sValue)) {
if (! copyOptions.testPropertyFilter(tDesc.getField(), sValue)) {
return;
}

View File

@ -108,7 +108,7 @@ public class SimpleCache<K, V> implements Iterable<Map.Entry<K, V>>, Serializabl
*/
public V get(final K key, final Predicate<V> validPredicate, final SerSupplier<V> supplier) {
V v = get(key);
if ((null != validPredicate && null != v && false == validPredicate.test(v))) {
if ((null != validPredicate && null != v && ! validPredicate.test(v))) {
v = null;
}
if (null == v && null != supplier) {
@ -118,7 +118,7 @@ public class SimpleCache<K, V> implements Iterable<Map.Entry<K, V>>, Serializabl
try {
// 双重检查防止在竞争锁的过程中已经有其它线程写入
v = get(key);
if (null == v || (null != validPredicate && false == validPredicate.test(v))) {
if (null == v || (null != validPredicate && ! validPredicate.test(v))) {
v = supplier.get();
put(key, v);
}

View File

@ -54,7 +54,7 @@ public class CacheObjIterator<K, V> implements Iterator<CacheObj<K, V>>, Seriali
*/
@Override
public CacheObj<K, V> next() {
if (false == hasNext()) {
if (! hasNext()) {
throw new NoSuchElementException();
}
final CacheObj<K, V> cachedObject = nextValue;

View File

@ -53,7 +53,7 @@ public abstract class ReentrantCache<K, V> extends AbstractCache<K, V> {
return false;
}
if (false == co.isExpired()) {
if (! co.isExpired()) {
// 命中
return true;
}
@ -80,7 +80,7 @@ public abstract class ReentrantCache<K, V> extends AbstractCache<K, V> {
if (null == co) {
missCount.increment();
return null;
} else if (false == co.isExpired()) {
} else if (! co.isExpired()) {
hitCount.increment();
return co.get(isUpdateLastAccess);
}

View File

@ -53,7 +53,7 @@ public abstract class StampedCache<K, V> extends AbstractCache<K, V>{
return false;
}
if (false == co.isExpired()) {
if (! co.isExpired()) {
// 命中
return true;
}
@ -71,7 +71,7 @@ public abstract class StampedCache<K, V> extends AbstractCache<K, V>{
// 尝试读取缓存使用乐观读锁
long stamp = lock.tryOptimisticRead();
CacheObj<K, V> co = getWithoutLock(key);
if(false == lock.validate(stamp)){
if(! lock.validate(stamp)){
// 有写线程修改了此对象悲观读
stamp = lock.readLock();
try {
@ -85,7 +85,7 @@ public abstract class StampedCache<K, V> extends AbstractCache<K, V>{
if (null == co) {
missCount.increment();
return null;
} else if (false == co.isExpired()) {
} else if (! co.isExpired()) {
hitCount.increment();
return co.get(isUpdateLastAccess);
}

View File

@ -351,7 +351,7 @@ public class ClassLoaderUtil {
int lastDotIndex = name.lastIndexOf(PACKAGE_SEPARATOR);
Class<?> clazz = null;
while (lastDotIndex > 0) {// 类与内部类的分隔符不能在第一位因此>0
if (false == Character.isUpperCase(name.charAt(lastDotIndex + 1))) {
if (! Character.isUpperCase(name.charAt(lastDotIndex + 1))) {
// 类名必须大写非大写的类名跳过
break;
}

View File

@ -173,7 +173,7 @@ public class JarClassLoader extends URLClassLoader {
* @since 4.4.2
*/
private static boolean isJarFile(final File file) {
if (false == FileUtil.isFile(file)) {
if (! FileUtil.isFile(file)) {
return false;
}
return file.getPath().toLowerCase().endsWith(".jar");

View File

@ -39,7 +39,7 @@ public class Caesar {
char c;
for (int i = 0; i < len; i++) {
c = message.charAt(i);
if (false == Character.isLetter(c)) {
if (! Character.isLetter(c)) {
continue;
}
plain[i] = encodeChar(c, offset);
@ -61,7 +61,7 @@ public class Caesar {
char c;
for (int i = 0; i < len; i++) {
c = cipherText.charAt(i);
if (false == Character.isLetter(c)) {
if (! Character.isLetter(c)) {
continue;
}
plain[i] = decodeChar(c, offset);

View File

@ -362,7 +362,7 @@ public class Hashids implements Encoder<long[], String>, Decoder<String, long[]>
final char[] currentAlphabet = Arrays.copyOf(alphabet, alphabet.length);
for (int i = startIdx + 1; i < endIdx; i++) {
if (false == separatorsSet.contains(hash.charAt(i))) {
if (! separatorsSet.contains(hash.charAt(i))) {
block.append(hash.charAt(i));
// continue if we have not reached the end, yet
if (i < endIdx - 1) {

View File

@ -163,7 +163,7 @@ public class Morse {
final char dit = this.dit;
final char dah = this.dah;
final char split = this.split;
if (false == StrUtil.containsOnly(morse, dit, dah, split)) {
if (! StrUtil.containsOnly(morse, dit, dah, split)) {
throw new IllegalArgumentException("Incorrect morse.");
}
final List<String> words = SplitUtil.split(morse, String.valueOf(split));

View File

@ -108,7 +108,7 @@ public class Base58 {
final byte[] payload = Arrays.copyOfRange(data, withVersion ? 1 : 0, data.length - CHECKSUM_SIZE);
final byte[] checksum = Arrays.copyOfRange(data, data.length - CHECKSUM_SIZE, data.length);
final byte[] expectedChecksum = checksum(payload);
if (false == Arrays.equals(checksum, expectedChecksum)) {
if (! Arrays.equals(checksum, expectedChecksum)) {
throw new ValidateException("Base58 checksum is invalid");
}
return payload;

View File

@ -290,7 +290,7 @@ public class Base64 {
} else if ('=' == base64Byte) {
// 发现'=' 标记之
hasPadding = true;
} else if (false == (Base64Decoder.INSTANCE.isBase64Code(base64Byte) || isWhiteSpace(base64Byte))) {
} else if (! (Base64Decoder.INSTANCE.isBase64Code(base64Byte) || isWhiteSpace(base64Byte))) {
return false;
}
}

View File

@ -111,7 +111,7 @@ public class ConsistentHash<T> implements Serializable {
return null;
}
int hash = hashFunc.hash32(key);
if (false == circle.containsKey(hash)) {
if (! circle.containsKey(hash)) {
final SortedMap<Integer, T> tailMap = circle.tailMap(hash); //返回此映射的部分视图其键大于等于 hash
hash = tailMap.isEmpty() ? circle.firstKey() : tailMap.firstKey();
}

View File

@ -100,7 +100,7 @@ public class CollUtil {
* @return 是否为空
*/
public static boolean isEmpty(final Enumeration<?> enumeration) {
return null == enumeration || false == enumeration.hasMoreElements();
return null == enumeration || ! enumeration.hasMoreElements();
}
/**
@ -179,7 +179,7 @@ public class CollUtil {
* @return 是否为非空
*/
public static boolean isNotEmpty(final Collection<?> collection) {
return false == isEmpty(collection);
return !isEmpty(collection);
}
/**
@ -2033,7 +2033,7 @@ public class CollUtil {
@Override
public int hash32(final T t) {
if (null == t || false == BeanUtil.isBean(t.getClass())) {
if (null == t || ! BeanUtil.isBean(t.getClass())) {
// 非Bean放在同一子分组中
return 0;
}

View File

@ -685,7 +685,7 @@ public class ListUtil {
@SuppressWarnings("UnusedReturnValue")
public static <T> List<T> addAllIfNotContains(final List<T> list, final List<T> otherList) {
for (final T t : otherList) {
if (false == list.contains(t)) {
if (! list.contains(t)) {
list.add(t);
}
}

View File

@ -65,7 +65,7 @@ public abstract class ComputeIter<T> implements Iterator<T> {
@Override
public T next() {
if (false == hasNext()) {
if (! hasNext()) {
throw new NoSuchElementException("No more lines");
}

View File

@ -58,7 +58,7 @@ public class FilterIter<E> implements Iterator<E> {
@Override
public E next() {
if (false == nextObjectSet && false == setNextObject()) {
if (! nextObjectSet && ! setNextObject()) {
throw new NoSuchElementException();
}
nextObjectSet = false;

View File

@ -89,7 +89,7 @@ public class IterChain<T> implements Iterator<T>, Chain<Iterator<T>, IterChain<T
@Override
public T next() {
if (false == hasNext()) {
if (! hasNext()) {
throw new NoSuchElementException();
}

View File

@ -66,7 +66,7 @@ public class IterUtil {
* @return 是否为空
*/
public static boolean isEmpty(final Iterator<?> iterator) {
return null == iterator || false == iterator.hasNext();
return null == iterator || ! iterator.hasNext();
}
/**
@ -737,12 +737,12 @@ public class IterUtil {
while (iter1.hasNext() && iter2.hasNext()) {
obj1 = iter1.next();
obj2 = iter2.next();
if (false == Objects.equals(obj1, obj2)) {
if (! Objects.equals(obj1, obj2)) {
return false;
}
}
// 当两个Iterable长度不一致时返回false
return false == (iter1.hasNext() || iter2.hasNext());
return ! (iter1.hasNext() || iter2.hasNext());
}
/**

View File

@ -66,7 +66,7 @@ public class PartitionIter<T> implements IterableIter<List<T>>, Serializable {
public List<T> next() {
final List<T> list = new ArrayList<>(this.partitionSize);
for (int i = 0; i < this.partitionSize; i++) {
if (false == iterator.hasNext()) {
if (! iterator.hasNext()) {
break;
}
list.add(iterator.next());

View File

@ -64,7 +64,7 @@ public class ZipCopyVisitor extends SimpleFileVisitor<Path> {
} catch (final DirectoryNotEmptyException ignore) {
// 目录已经存在则跳过
} catch (final FileAlreadyExistsException e) {
if (false == Files.isDirectory(targetDir)) {
if (! Files.isDirectory(targetDir)) {
throw e;
}
// 目录非空情况下跳过创建目录

View File

@ -976,7 +976,7 @@ public class ZipUtil {
name = entry.getName();
if (StrUtil.isEmpty(dir) || name.startsWith(dir)) {
final String nameSuffix = StrUtil.removePrefix(name, dir);
if (StrUtil.isNotEmpty(nameSuffix) && false == StrUtil.contains(nameSuffix, CharUtil.SLASH)) {
if (StrUtil.isNotEmpty(nameSuffix) && ! StrUtil.contains(nameSuffix, CharUtil.SLASH)) {
fileNames.add(nameSuffix);
}
}
@ -1002,7 +1002,7 @@ public class ZipUtil {
if (null == srcFile) {
continue;
}
if (false == srcFile.exists()) {
if (! srcFile.exists()) {
throw new UtilException(StrUtil.format("File [{}] not exist!", srcFile.getAbsolutePath()));
}

View File

@ -149,7 +149,7 @@ public class ZipWriter implements Closeable {
String srcRootDir;
try {
srcRootDir = file.getCanonicalPath();
if ((false == file.isDirectory()) || withSrcDir) {
if ((! file.isDirectory()) || withSrcDir) {
// 若是文件则将父目录完整路径都截取掉若设置包含目录则将上级目录全部截取掉保留本目录名
srcRootDir = file.getCanonicalFile().getParentFile().getCanonicalPath();
}
@ -259,7 +259,7 @@ public class ZipWriter implements Closeable {
*/
@SuppressWarnings("resource")
private void _add(final File file, final String srcRootDir, final FileFilter filter) throws IORuntimeException {
if (null == file || (null != filter && false == filter.accept(file))) {
if (null == file || (null != filter && ! filter.accept(file))) {
return;
}

View File

@ -59,7 +59,7 @@ public enum BasicType {
* @return 包装类
*/
public static Class<?> wrap(final Class<?> clazz, boolean errorReturnNull) {
if (null == clazz || false == clazz.isPrimitive()) {
if (null == clazz || ! clazz.isPrimitive()) {
return clazz;
}
final Class<?> result = WRAPPER_PRIMITIVE_MAP.getInverse().get(clazz);

View File

@ -107,7 +107,7 @@ public class NumberChineseFormatter {
yuan = yuan / 10;
//
if (false == isMoneyMode || 0 != yuan) {
if (! isMoneyMode || 0 != yuan) {
// 金额模式下无需零元
chineseStr.append(longToChinese(yuan, isUseTraditional));
if (isMoneyMode) {
@ -124,14 +124,14 @@ public class NumberChineseFormatter {
}
// 小数部分
if (false == isMoneyMode) {
if (! isMoneyMode) {
chineseStr.append("");
}
//
if (0 == yuan && 0 == jiao) {
// 元和角都为0时只有非金额模式下补
if (false == isMoneyMode) {
if (! isMoneyMode) {
chineseStr.append("");
}
} else {
@ -356,7 +356,7 @@ public class NumberChineseFormatter {
for (int i = 0; temp > 0; i++) {
final int digit = temp % 10;
if (digit == 0) { // 取到的数字为 0
if (false == lastIsZero) {
if (! lastIsZero) {
// 前一个数字不是 0则在当前汉字串前加;
chineseStr.insert(0, "");
}

View File

@ -74,7 +74,7 @@ public class NumberWordFormatter {
}
int index = -1;
double res = value;
while (res > 10 && (false == isTwo || index < 1)) {
while (res > 10 && (! isTwo || index < 1)) {
if (res >= 1000) {
res = res / 1000;
index++;
@ -119,7 +119,7 @@ public class NumberWordFormatter {
StringBuilder lm = new StringBuilder(); // 用来存放转换后的整数部分
for (int i = 0; i < lstrrev.length() / 3; i++) {
a[i] = StrUtil.reverse(lstrrev.substring(3 * i, 3 * i + 3)); // 截取第一个三位
if (false == "000".equals(a[i])) { // 用来避免这种情况1000000 = one million
if (! "000".equals(a[i])) { // 用来避免这种情况1000000 = one million
// thousand only
if (i != 0) {
lm.insert(0, transThree(a[i]) + " " + parseMore(i) + " "); // :

View File

@ -34,7 +34,7 @@ public class AtomicReferenceConverter extends AbstractConverter {
//尝试将值转换为Reference泛型的类型
Object targetValue = null;
final Type paramType = TypeUtil.getTypeArgument(AtomicReference.class);
if(false == TypeUtil.isUnknown(paramType)){
if(! TypeUtil.isUnknown(paramType)){
targetValue = CompositeConverter.getInstance().convert(paramType, value);
}
if(null == targetValue){

View File

@ -44,7 +44,7 @@ public class EnumConverter extends AbstractConverter {
@Override
protected Object convertInternal(final Class<?> targetClass, final Object value) {
Enum enumValue = tryConvertEnum(value, targetClass);
if (null == enumValue && false == value instanceof String) {
if (null == enumValue && ! value instanceof String) {
// 最后尝试先将value转String再valueOf转换
enumValue = Enum.valueOf((Class) targetClass, convertToStr(value));
}
@ -134,7 +134,7 @@ public class EnumConverter extends AbstractConverter {
.filter(ModifierUtil::isStatic)
.filter(m -> m.getReturnType() == enumClass)
.filter(m -> m.getParameterCount() == 1)
.filter(m -> false == "valueOf".equals(m.getName()))
.filter(m -> ! "valueOf".equals(m.getName()))
.collect(Collectors.toMap(m -> m.getParameterTypes()[0], m -> m, (k1, k2) -> k1)));
}
}

View File

@ -41,7 +41,7 @@ public class ReferenceConverter extends AbstractConverter {
//尝试将值转换为Reference泛型的类型
Object targetValue = null;
final Type paramType = TypeUtil.getTypeArgument(targetClass);
if(false == TypeUtil.isUnknown(paramType)){
if(! TypeUtil.isUnknown(paramType)){
targetValue = CompositeConverter.getInstance().convert(paramType, value);
}
if(null == targetValue){

View File

@ -777,7 +777,7 @@ public class CalendarUtil {
final int dayOfMonthBirth = cal.get(Calendar.DAY_OF_MONTH);
final boolean isLastDayOfMonthBirth = dayOfMonthBirth == cal.getActualMaximum(Calendar.DAY_OF_MONTH);
// issue#I6E6ZG法定生日当天不算年龄从第二天开始计算
if ((false == isLastDayOfMonth || false == isLastDayOfMonthBirth) && dayOfMonth <= dayOfMonthBirth) {
if ((! isLastDayOfMonth || ! isLastDayOfMonthBirth) && dayOfMonth <= dayOfMonthBirth) {
// 如果生日在当月但是未达到生日当天的日期年龄减一
age--;
}

View File

@ -124,7 +124,7 @@ public class DateBetween implements Serializable {
final int betweenMonthOfYear = endCal.get(Calendar.MONTH) - beginCal.get(Calendar.MONTH);
final int result = betweenYear * 12 + betweenMonthOfYear;
if (false == isReset) {
if (! isReset) {
endCal.set(Calendar.YEAR, beginCal.get(Calendar.YEAR));
endCal.set(Calendar.MONTH, beginCal.get(Calendar.MONTH));
final long between = endCal.getTimeInMillis() - beginCal.getTimeInMillis();
@ -148,7 +148,7 @@ public class DateBetween implements Serializable {
final Calendar endCal = DateUtil.calendar(end);
final int result = endCal.get(Calendar.YEAR) - beginCal.get(Calendar.YEAR);
if (false == isReset) {
if (! isReset) {
// 考虑闰年的2月情况
if (Calendar.FEBRUARY == beginCal.get(Calendar.MONTH) && Calendar.FEBRUARY == endCal.get(Calendar.MONTH)) {
if (beginCal.get(Calendar.DAY_OF_MONTH) == beginCal.getActualMaximum(Calendar.DAY_OF_MONTH)

View File

@ -431,7 +431,7 @@ public class DateTime extends Date {
calendar.set(field, value);
DateTime dt = this;
if (false == mutable) {
if (! mutable) {
dt = ObjUtil.clone(this);
}
return dt.setTimeInternal(calendar.getTimeInMillis());

View File

@ -677,7 +677,7 @@ public class DateUtil extends CalendarUtil {
return null;
}
if (false == isUppercase) {
if (! isUppercase) {
return (withTime ? DatePattern.CHINESE_DATE_TIME_FORMAT : DatePattern.CHINESE_DATE_FORMAT).format(date);
}
@ -1434,11 +1434,11 @@ public class DateUtil extends CalendarUtil {
boolean isIn = rangeMin < thisMills && thisMills < rangeMax;
// 若不满足则再判断是否在时间范围的边界上
if (false == isIn && includeBegin) {
if (! isIn && includeBegin) {
isIn = thisMills == rangeMin;
}
if (false == isIn && includeEnd) {
if (! isIn && includeEnd) {
isIn = thisMills == rangeMax;
}

View File

@ -226,11 +226,11 @@ public class TemporalAccessorUtil extends TemporalUtil{
boolean isIn = rangeMin < thisMills && thisMills < rangeMax;
// 若不满足则再判断是否在时间范围的边界上
if (false == isIn && includeBegin) {
if (! isIn && includeBegin) {
isIn = thisMills == rangeMin;
}
if (false == isIn && includeEnd) {
if (! isIn && includeEnd) {
isIn = thisMills == rangeMax;
}

View File

@ -116,7 +116,7 @@ public class ChineseDate {
}
this.isLeapMonth = leapMonth > 0 && (month == (leapMonth + 1));
if (hasLeapMonth && false == this.isLeapMonth) {
if (hasLeapMonth && ! this.isLeapMonth) {
// 当前月份前有闰月则月份显示要-1除非当前月份就是润月
month--;
}
@ -453,7 +453,7 @@ public class ChineseDate {
boolean isAdd = false;
for (int i = 1; i < chineseMonth; i++) {
leap = LunarInfo.leapMonth(chineseYear);
if (false == isAdd) {//处理闰月
if (! isAdd) {//处理闰月
if (leap <= i && leap > 0) {
offset += LunarInfo.leapDays(chineseYear);
isAdd = true;

View File

@ -265,7 +265,7 @@ public class FastDateParser extends SimpleDateBasic implements PositionDateParse
while (lt.hasNext()) {
final StrategyAndWidth strategyAndWidth = lt.next();
final int maxWidth = strategyAndWidth.getMaxWidth(lt);
if (false == strategyAndWidth.strategy.parse(this, calendar, source, pos, maxWidth)) {
if (! strategyAndWidth.strategy.parse(this, calendar, source, pos, maxWidth)) {
return false;
}
}

View File

@ -64,7 +64,7 @@ public class ISO8601DateParser extends DefaultDateBasic implements DateParser {
if (StrUtil.isBlank(zoneOffset)) {
throw new DateException("Invalid format: [{}]", source);
}
if (false == StrUtil.contains(zoneOffset, ':')) {
if (! StrUtil.contains(zoneOffset, ':')) {
// +0800转换为+08:00
final String pre = StrUtil.subBefore(source, '+', true);
source = pre + "+" + zoneOffset.substring(0, 2) + ":" + "00";

View File

@ -404,7 +404,7 @@ public class ExceptionUtil {
*/
public static List<Throwable> getThrowableList(Throwable throwable) {
final List<Throwable> list = new ArrayList<>();
while (throwable != null && false == list.contains(throwable)) {
while (throwable != null && ! list.contains(throwable)) {
list.add(throwable);
throwable = throwable.getCause();
}

View File

@ -112,7 +112,7 @@ public class AppendableWriter extends Writer implements Appendable {
@Override
public void close() throws IOException {
if (false == closed) {
if (! closed) {
flush();
if (appendable instanceof Closeable) {
((Closeable) appendable).close();

View File

@ -717,7 +717,7 @@ public class IoUtil extends NioUtil {
if (null == in) {
return null;
}
if (false == in.markSupported()) {
if (! in.markSupported()) {
return new BufferedInputStream(in);
}
return in;
@ -734,7 +734,7 @@ public class IoUtil extends NioUtil {
if (null == reader) {
return null;
}
if (false == reader.markSupported()) {
if (! reader.markSupported()) {
return new BufferedReader(reader);
}
return reader;
@ -951,10 +951,10 @@ public class IoUtil extends NioUtil {
* @since 4.0.6
*/
public static boolean contentEquals(InputStream input1, InputStream input2) throws IORuntimeException {
if (false == (input1 instanceof BufferedInputStream)) {
if (! (input1 instanceof BufferedInputStream)) {
input1 = new BufferedInputStream(input1);
}
if (false == (input2 instanceof BufferedInputStream)) {
if (! (input2 instanceof BufferedInputStream)) {
input2 = new BufferedInputStream(input2);
}

View File

@ -79,7 +79,7 @@ public class LineReader extends ReaderWrapper implements Iterable<String> {
}
if (CharUtil.BACKSLASH == c) {
// 转义符转义行尾需要使用'\'使用转义符转义`\\`
if (false == precedingBackslash) {
if (! precedingBackslash) {
// 转义符添加标识但是不加入字符
precedingBackslash = true;
continue;

View File

@ -37,7 +37,7 @@ public class SerializeUtil {
* @throws UtilException IO异常和ClassNotFoundException封装
*/
public static <T> T clone(final T obj) {
if (false == (obj instanceof Serializable)) {
if (! (obj instanceof Serializable)) {
return null;
}
return deserialize(serialize(obj));
@ -52,7 +52,7 @@ public class SerializeUtil {
* @return 序列化后的字节码
*/
public static <T> byte[] serialize(final T obj) {
if (false == (obj instanceof Serializable)) {
if (! (obj instanceof Serializable)) {
return null;
}
final FastByteArrayOutputStream byteOut = new FastByteArrayOutputStream();

View File

@ -1507,7 +1507,7 @@ public enum FileMagicNumber {
*/
private static FileMagicNumber matchDocument(final byte[] bytes) {
final FileMagicNumber fileMagicNumber = FileMagicNumber.matchOpenXmlMime(bytes, (byte) 0x1e);
if (false == fileMagicNumber.equals(UNKNOWN)) {
if (! fileMagicNumber.equals(UNKNOWN)) {
return fileMagicNumber;
}
final byte[] bytes1 = new byte[]{0x5B, 0x43, 0x6F, 0x6E, 0x74, 0x65, 0x6E, 0x74, 0x5F, 0x54, 0x79, 0x70, 0x65, 0x73, 0x5D, 0x2E, 0x78, 0x6D, 0x6C};
@ -1516,7 +1516,7 @@ public enum FileMagicNumber {
final boolean flag1 = FileMagicNumber.compareBytes(bytes, bytes1, (byte) 0x1e);
final boolean flag2 = FileMagicNumber.compareBytes(bytes, bytes2, (byte) 0x1e);
final boolean flag3 = FileMagicNumber.compareBytes(bytes, bytes3, (byte) 0x1e);
if (false == (flag1 || flag2 || flag3)) {
if (! (flag1 || flag2 || flag3)) {
return UNKNOWN;
}
int index = 0;
@ -1526,7 +1526,7 @@ public enum FileMagicNumber {
continue;
}
final FileMagicNumber fn = FileMagicNumber.matchOpenXmlMime(bytes, index + 30);
if (false == fn.equals(UNKNOWN)) {
if (! fn.equals(UNKNOWN)) {
return fn;
}
}

View File

@ -307,7 +307,7 @@ public class FileNameUtil {
* @since 3.3.1
*/
public static boolean containsInvalid(final String fileName) {
return (false == StrUtil.isBlank(fileName)) && ReUtil.contains(FILE_NAME_INVALID_PATTERN_WIN, fileName);
return (! StrUtil.isBlank(fileName)) && ReUtil.contains(FILE_NAME_INVALID_PATTERN_WIN, fileName);
}
/**
@ -388,7 +388,7 @@ public class FileNameUtil {
// 去除类似于/C:这类路径开头的斜杠
prefix = prefix.substring(1);
}
if (false == prefix.contains(StrUtil.SLASH)) {
if (! prefix.contains(StrUtil.SLASH)) {
pathToUse = pathToUse.substring(prefixIndex + 1);
} else {
// 如果前缀中包含/,说明非Windows风格path
@ -408,7 +408,7 @@ public class FileNameUtil {
for (int i = pathList.size() - 1; i >= 0; i--) {
element = pathList.get(i);
// 只处理非.的目录即只处理非当前目录
if (false == StrUtil.DOT.equals(element)) {
if (! StrUtil.DOT.equals(element)) {
if (StrUtil.DOUBLE_DOT.equals(element)) {
tops++;
} else {

View File

@ -256,10 +256,10 @@ public class FileReader extends FileWrapper {
* @throws IORuntimeException IO异常
*/
private void checkFile() throws IORuntimeException {
if (false == file.exists()) {
if (! file.exists()) {
throw new IORuntimeException("File not exist: " + file);
}
if (false == file.isFile()) {
if (! file.isFile()) {
throw new IORuntimeException("Not a file:" + file);
}
}

View File

@ -106,7 +106,7 @@ public class FileUtil extends PathUtil {
* @return 是否为空当提供非目录时返回false
*/
public static boolean isEmpty(final File file) {
if (null == file || false == file.exists()) {
if (null == file || ! file.exists()) {
return true;
}
@ -121,13 +121,14 @@ public class FileUtil extends PathUtil {
}
/**
* 目录是否为空
* 文件是不为空<br>
* 目录里面有文件或目录 文件文件大小大于0时
*
* @param file 目录
* @return 是否为空当提供非目录时返回false
*/
public static boolean isNotEmpty(final File file) {
return false == isEmpty(file);
return !isEmpty(file);
}
/**
@ -447,7 +448,7 @@ public class FileUtil extends PathUtil {
*/
public static boolean exists(final String directory, final String regexp) {
final File file = new File(directory);
if (false == file.exists()) {
if (! file.exists()) {
return false;
}
@ -474,7 +475,7 @@ public class FileUtil extends PathUtil {
* @return 最后修改时间
*/
public static Date lastModifiedTime(final File file) {
if (false == exists(file)) {
if (! exists(file)) {
return null;
}
@ -516,7 +517,7 @@ public class FileUtil extends PathUtil {
* @since 5.7.21
*/
public static long size(final File file, final boolean includeDirSize) {
if (null == file || false == file.exists() || isSymlink(file)) {
if (null == file || ! file.exists() || isSymlink(file)) {
return 0;
}
@ -544,7 +545,7 @@ public class FileUtil extends PathUtil {
* @since 5.7.22
*/
public static int getTotalLines(final File file) {
if (false == isFile(file)) {
if (! isFile(file)) {
throw new IORuntimeException("Input must be a File");
}
try (final LineNumberReader lineNumberReader = new LineNumberReader(new java.io.FileReader(file))) {
@ -568,7 +569,7 @@ public class FileUtil extends PathUtil {
* @return 是否晚于给定时间
*/
public static boolean newerThan(final File file, final File reference) {
if (null == reference || false == reference.exists()) {
if (null == reference || ! reference.exists()) {
return true;// 文件一定比一个不存在的文件新
}
return newerThan(file, reference.lastModified());
@ -582,7 +583,7 @@ public class FileUtil extends PathUtil {
* @return 是否晚于给定时间
*/
public static boolean newerThan(final File file, final long timeMillis) {
if (null == file || false == file.exists()) {
if (null == file || ! file.exists()) {
return false;// 不存在的文件一定比任何时间旧
}
return file.lastModified() > timeMillis;
@ -616,7 +617,7 @@ public class FileUtil extends PathUtil {
if (null == file) {
return null;
}
if (false == file.exists()) {
if (! file.exists()) {
mkParentDirs(file);
try {
//noinspection ResultOfMethodCallIgnored
@ -758,7 +759,7 @@ public class FileUtil extends PathUtil {
if (dir == null) {
return null;
}
if (false == dir.exists()) {
if (! dir.exists()) {
mkdirsSafely(dir, 5, 1);
}
return dir;
@ -1211,10 +1212,10 @@ public class FileUtil extends PathUtil {
public static boolean equals(final File file1, final File file2) throws IORuntimeException {
Assert.notNull(file1);
Assert.notNull(file2);
if (false == file1.exists() || false == file2.exists()) {
if (! file1.exists() || ! file2.exists()) {
// 两个文件都不存在判断其路径是否相同 对于一个存在一个不存在的情况一定不相同
return false == file1.exists()//
&& false == file2.exists()//
return ! file1.exists()//
&& ! file2.exists()//
&& pathEquals(file1, file2);
}
return equals(file1.toPath(), file2.toPath());
@ -1237,7 +1238,7 @@ public class FileUtil extends PathUtil {
return false;
}
if (false == file1Exists) {
if (! file1Exists) {
// 两个文件都不存在返回true
return true;
}
@ -1382,7 +1383,7 @@ public class FileUtil extends PathUtil {
* @return 是否被改动
*/
public static boolean isModified(final File file, final long lastModifyTime) {
if (null == file || false == file.exists()) {
if (null == file || ! file.exists()) {
return true;
}
return file.lastModified() != lastModifyTime;
@ -2653,7 +2654,7 @@ public class FileUtil extends PathUtil {
parentCanonicalPath = parentFile.getAbsolutePath();
canonicalPath = file.getAbsolutePath();
}
if (false == canonicalPath.startsWith(parentCanonicalPath)) {
if (! canonicalPath.startsWith(parentCanonicalPath)) {
throw new IllegalArgumentException("New file is outside of the parent dir: " + file.getName());
}
}
@ -2801,7 +2802,7 @@ public class FileUtil extends PathUtil {
private static File buildFile(File outFile, String fileName) {
// 替换Windows路径分隔符为Linux路径分隔符便于统一处理
fileName = fileName.replace(CharUtil.BACKSLASH, CharUtil.SLASH);
if (false == isWindows()
if (! isWindows()
// 检查文件名中是否包含"/"不考虑以"/"结尾的情况
&& fileName.lastIndexOf(CharUtil.SLASH, fileName.length() - 2) > 0) {
// 在Linux下多层目录创建存在问题/会被当成文件名的一部分此处做处理

View File

@ -401,7 +401,7 @@ public class FileWriter extends FileWrapper {
*/
private void checkFile() throws IORuntimeException {
Assert.notNull(file, "File to write content is null !");
if (this.file.exists() && false == file.isFile()) {
if (this.file.exists() && ! file.isFile()) {
throw new IORuntimeException("File [{}] is not a file !", this.file.getAbsoluteFile());
}
}

View File

@ -65,7 +65,7 @@ public class PathCopier extends SrcToDestCopier<Path, PathCopier> {
*/
public PathCopier(final Path src, final Path target, final CopyOption[] options) {
Assert.notNull(target, "Src path must be not null !");
if (false == PathUtil.exists(src, false)) {
if (! PathUtil.exists(src, false)) {
throw new IllegalArgumentException("Src path is not exist!");
}
this.src = src;

View File

@ -66,7 +66,7 @@ public class PathMover {
*/
public PathMover(final Path src, final Path target, final CopyOption[] options) {
Assert.notNull(target, "Src path must be not null !");
if(false == PathUtil.exists(src, false)){
if(! PathUtil.exists(src, false)){
throw new IllegalArgumentException("Src path is not exist!");
}
this.src = src;

View File

@ -41,7 +41,7 @@ public class PathUtil {
*/
public static boolean isDirEmpty(final Path dirPath) {
try (final DirectoryStream<Path> dirStream = Files.newDirectoryStream(dirPath)) {
return false == dirStream.iterator().hasNext();
return ! dirStream.iterator().hasNext();
} catch (final IOException e) {
throw new IORuntimeException(e);
}
@ -73,9 +73,9 @@ public class PathUtil {
public static List<File> loopFiles(final Path path, final int maxDepth, final FileFilter fileFilter) {
final List<File> fileList = new ArrayList<>();
if (null == path || false == Files.exists(path)) {
if (null == path || ! Files.exists(path)) {
return fileList;
} else if (false == isDirectory(path)) {
} else if (! isDirectory(path)) {
final File file = path.toFile();
if (null == fileFilter || fileFilter.accept(file)) {
fileList.add(file);
@ -223,7 +223,7 @@ public class PathUtil {
* @since 3.1.0
*/
public static boolean isExistsAndNotDirectory(final Path path, final boolean isFollowLinks) {
return exists(path, isFollowLinks) && false == isDirectory(path, isFollowLinks);
return exists(path, isFollowLinks) && ! isDirectory(path, isFollowLinks);
}
/**
@ -576,7 +576,7 @@ public class PathUtil {
* @since 5.5.7
*/
public static Path mkdir(final Path dir) {
if (null != dir && false == exists(dir, false)) {
if (null != dir && ! exists(dir, false)) {
try {
Files.createDirectories(dir);
} catch (final IOException e) {

View File

@ -137,7 +137,7 @@ public class Tailer implements Serializable {
this.period, TimeUnit.MILLISECONDS//
);
if (false == async) {
if (! async) {
try {
scheduledFuture.get();
} catch (final ExecutionException e) {
@ -206,7 +206,7 @@ public class Tailer implements Serializable {
}
// 输出缓存栈中的内容
while (false == stack.isEmpty()) {
while (! stack.isEmpty()) {
this.lineHandler.accept(stack.pop());
}
}
@ -225,10 +225,10 @@ public class Tailer implements Serializable {
* @param file 文件
*/
private static void checkFile(final File file) {
if (false == file.exists()) {
if (! file.exists()) {
throw new UtilException("File [{}] not exist !", file.getAbsolutePath());
}
if (false == file.isFile()) {
if (! file.isFile()) {
throw new UtilException("Path [{}] is not a file !", file.getAbsolutePath());
}
}

View File

@ -52,7 +52,7 @@ public class CopyVisitor extends SimpleFileVisitor<Path> {
* @param copyOptions 拷贝选项如跳过已存在等
*/
public CopyVisitor(final Path source, final Path target, final CopyOption... copyOptions) {
if (PathUtil.exists(target, false) && false == PathUtil.isDirectory(target)) {
if (PathUtil.exists(target, false) && ! PathUtil.isDirectory(target)) {
throw new IllegalArgumentException("Target must be a directory");
}
this.source = source;
@ -70,7 +70,7 @@ public class CopyVisitor extends SimpleFileVisitor<Path> {
try {
Files.copy(dir, targetDir, copyOptions);
} catch (final FileAlreadyExistsException e) {
if (false == Files.isDirectory(targetDir)) {
if (! Files.isDirectory(targetDir)) {
// 目标文件存在抛出异常目录忽略
throw e;
}
@ -107,7 +107,7 @@ public class CopyVisitor extends SimpleFileVisitor<Path> {
* 初始化目标文件或目录
*/
private void initTargetDir() {
if (false == this.isTargetCreated) {
if (! this.isTargetCreated) {
PathUtil.mkdir(this.target);
this.isTargetCreated = true;
}

View File

@ -45,7 +45,7 @@ public class MoveVisitor extends SimpleFileVisitor<Path> {
* @param copyOptions 拷贝移动选项
*/
public MoveVisitor(final Path source, final Path target, final CopyOption... copyOptions) {
if(PathUtil.exists(target, false) && false == PathUtil.isDirectory(target)){
if(PathUtil.exists(target, false) && ! PathUtil.isDirectory(target)){
throw new IllegalArgumentException("Target must be a directory");
}
this.source = source;
@ -59,9 +59,9 @@ public class MoveVisitor extends SimpleFileVisitor<Path> {
initTarget();
// 将当前目录相对于源路径转换为相对于目标路径
final Path targetDir = target.resolve(source.relativize(dir));
if(false == Files.exists(targetDir)){
if(! Files.exists(targetDir)){
Files.createDirectories(targetDir);
} else if(false == Files.isDirectory(targetDir)){
} else if(! Files.isDirectory(targetDir)){
throw new FileAlreadyExistsException(targetDir.toString());
}
return FileVisitResult.CONTINUE;
@ -79,7 +79,7 @@ public class MoveVisitor extends SimpleFileVisitor<Path> {
* 初始化目标文件或目录
*/
private void initTarget(){
if(false == this.isTargetCreated){
if(! this.isTargetCreated){
PathUtil.mkdir(this.target);
this.isTargetCreated = true;
}

View File

@ -88,7 +88,7 @@ public class BOMInputStream extends InputStream {
* @return 编码
*/
public String getCharset() {
if (false == isInited) {
if (! isInited) {
try {
init();
} catch (final IOException ex) {

View File

@ -53,7 +53,7 @@ public class SyncInputStream extends FilterInputStream {
super(in);
this.length = length;
this.isIgnoreEOFError = isIgnoreEOFError;
if (false == isAsync) {
if (! isAsync) {
sync();
}
}
@ -93,7 +93,7 @@ public class SyncInputStream extends FilterInputStream {
try {
copyLength = IoUtil.copy(this.in, out, IoUtil.DEFAULT_BUFFER_SIZE, this.length, streamProgress);
} catch (final IORuntimeException e) {
if (false == (isIgnoreEOFError && isEOFException(e.getCause()))) {
if (! (isIgnoreEOFError && isEOFException(e.getCause()))) {
throw e;
}
// 忽略读取流中的EOF错误

View File

@ -302,13 +302,13 @@ public class WatchMonitor extends WatchServer {
@Override
public void init() throws WatchException {
//获取目录或文件路径
if (false == PathUtil.exists(this.path, false)) {
if (! PathUtil.exists(this.path, false)) {
// 不存在的路径
final Path lastPathEle = FileUtil.getLastPathEle(this.path);
if (null != lastPathEle) {
final String lastPathEleStr = lastPathEle.toString();
//带有点表示有扩展名按照未创建的文件对待Linux下.d的为目录排除之
if (StrUtil.contains(lastPathEleStr, CharUtil.DOT) && false == StrUtil.endWithIgnoreCase(lastPathEleStr, ".d")) {
if (StrUtil.contains(lastPathEleStr, CharUtil.DOT) && ! StrUtil.endWithIgnoreCase(lastPathEleStr, ".d")) {
this.filePath = this.path;
this.path = this.filePath.getParent();
}
@ -364,7 +364,7 @@ public class WatchMonitor extends WatchServer {
registerPath();
// log.debug("Start watching path: [{}]", this.path);
while (false == isClosed) {
while (! isClosed) {
doTakeAndWatch(watcher);
}
}

View File

@ -130,7 +130,7 @@ public class WatchServer extends Thread implements Closeable, Serializable {
});
}
} catch (final IOException e) {
if (false == (e instanceof AccessDeniedException)) {
if (! (e instanceof AccessDeniedException)) {
throw new WatchException(e);
}
@ -159,7 +159,7 @@ public class WatchServer extends Thread implements Closeable, Serializable {
for (final WatchEvent<?> event : wk.pollEvents()) {
// 如果监听文件检查当前事件是否与所监听文件关联
if (null != watchFilter && false == watchFilter.test(event)) {
if (null != watchFilter && ! watchFilter.test(event)) {
continue;
}

View File

@ -45,7 +45,7 @@ public class Assert {
* @throws X if expression is {@code false}
*/
public static <X extends Throwable> void isTrue(final boolean expression, final Supplier<? extends X> supplier) throws X {
if (false == expression) {
if (! expression) {
throw supplier.get();
}
}
@ -701,7 +701,7 @@ public class Assert {
*/
public static <T> T isInstanceOf(final Class<?> type, final T obj, final String errorMsgTemplate, final Object... params) throws IllegalArgumentException {
notNull(type, "Type to check against must not be null");
if (false == type.isInstance(obj)) {
if (! type.isInstance(obj)) {
throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params));
}
return obj;
@ -755,7 +755,7 @@ public class Assert {
* @throws IllegalStateException 表达式为 {@code false} 抛出此异常
*/
public static void state(final boolean expression, final Supplier<String> errorMsgSupplier) throws IllegalStateException {
if (false == expression) {
if (! expression) {
throw new IllegalStateException(errorMsgSupplier.get());
}
}
@ -772,7 +772,7 @@ public class Assert {
* @throws IllegalStateException 表达式为 {@code false} 抛出此异常
*/
public static void state(final boolean expression, final String errorMsgTemplate, final Object... params) throws IllegalStateException {
if (false == expression) {
if (! expression) {
throw new IllegalStateException(StrUtil.format(errorMsgTemplate, params));
}
}

View File

@ -63,7 +63,7 @@ public class Validator {
* @since 4.4.5
*/
public static boolean isFalse(final boolean value) {
return false == value;
return ! value;
}
/**
@ -161,9 +161,10 @@ public class Validator {
*
* @param value
* @return 是否为空
* @see ObjUtil#isEmpty(Object)
*/
public static boolean isEmpty(final Object value) {
return (null == value || (value instanceof String && StrUtil.isEmpty((String) value)));
return ObjUtil.isEmpty(value);
}
/**
@ -172,9 +173,10 @@ public class Validator {
*
* @param value
* @return 是否为空
* @see ObjUtil#isNotEmpty(Object)
*/
public static boolean isNotEmpty(final Object value) {
return false == isEmpty(value);
return ObjUtil.isNotEmpty(value);
}
/**
@ -233,7 +235,7 @@ public class Validator {
* @throws ValidateException 验证异常
*/
public static Object validateEqual(final Object t1, final Object t2, final String errorMsg) throws ValidateException {
if (false == equal(t1, t2)) {
if (! equal(t1, t2)) {
throw new ValidateException(errorMsg);
}
return t1;
@ -295,7 +297,7 @@ public class Validator {
* @throws ValidateException 验证异常
*/
public static <T extends CharSequence> T validateMatchRegex(final String regex, final T value, final String errorMsg) throws ValidateException {
if (false == isMatchRegex(regex, value)) {
if (! isMatchRegex(regex, value)) {
throw new ValidateException(errorMsg);
}
return value;
@ -343,7 +345,7 @@ public class Validator {
* @throws ValidateException 验证异常
*/
public static <T extends CharSequence> T validateGeneral(final T value, final String errorMsg) throws ValidateException {
if (false == isGeneral(value)) {
if (! isGeneral(value)) {
throw new ValidateException(errorMsg);
}
return value;
@ -380,7 +382,7 @@ public class Validator {
* @throws ValidateException 验证异常
*/
public static <T extends CharSequence> T validateGeneral(final T value, final int min, final int max, final String errorMsg) throws ValidateException {
if (false == isGeneral(value, min, max)) {
if (! isGeneral(value, min, max)) {
throw new ValidateException(errorMsg);
}
return value;
@ -433,7 +435,7 @@ public class Validator {
* @since 3.3.0
*/
public static <T extends CharSequence> T validateLetter(final T value, final String errorMsg) throws ValidateException {
if (false == isLetter(value)) {
if (! isLetter(value)) {
throw new ValidateException(errorMsg);
}
return value;
@ -461,7 +463,7 @@ public class Validator {
* @since 3.3.0
*/
public static <T extends CharSequence> T validateUpperCase(final T value, final String errorMsg) throws ValidateException {
if (false == isUpperCase(value)) {
if (! isUpperCase(value)) {
throw new ValidateException(errorMsg);
}
return value;
@ -489,7 +491,7 @@ public class Validator {
* @since 3.3.0
*/
public static <T extends CharSequence> T validateLowerCase(final T value, final String errorMsg) throws ValidateException {
if (false == isLowerCase(value)) {
if (! isLowerCase(value)) {
throw new ValidateException(errorMsg);
}
return value;
@ -525,7 +527,7 @@ public class Validator {
* @throws ValidateException 验证异常
*/
public static String validateNumber(final String value, final String errorMsg) throws ValidateException {
if (false == isNumber(value)) {
if (! isNumber(value)) {
throw new ValidateException(errorMsg);
}
return value;
@ -553,7 +555,7 @@ public class Validator {
* @since 4.1.8
*/
public static <T extends CharSequence> T validateWord(final T value, final String errorMsg) throws ValidateException {
if (false == isWord(value)) {
if (! isWord(value)) {
throw new ValidateException(errorMsg);
}
return value;
@ -579,7 +581,7 @@ public class Validator {
* @throws ValidateException 验证异常
*/
public static <T extends CharSequence> T validateMoney(final T value, final String errorMsg) throws ValidateException {
if (false == isMoney(value)) {
if (! isMoney(value)) {
throw new ValidateException(errorMsg);
}
return value;
@ -606,7 +608,7 @@ public class Validator {
* @throws ValidateException 验证异常
*/
public static <T extends CharSequence> T validateZipCode(final T value, final String errorMsg) throws ValidateException {
if (false == isZipCode(value)) {
if (! isZipCode(value)) {
throw new ValidateException(errorMsg);
}
return value;
@ -632,7 +634,7 @@ public class Validator {
* @throws ValidateException 验证异常
*/
public static <T extends CharSequence> T validateEmail(final T value, final String errorMsg) throws ValidateException {
if (false == isEmail(value)) {
if (! isEmail(value)) {
throw new ValidateException(errorMsg);
}
return value;
@ -658,7 +660,7 @@ public class Validator {
* @throws ValidateException 验证异常
*/
public static <T extends CharSequence> T validateMobile(final T value, final String errorMsg) throws ValidateException {
if (false == isMobile(value)) {
if (! isMobile(value)) {
throw new ValidateException(errorMsg);
}
return value;
@ -684,7 +686,7 @@ public class Validator {
* @throws ValidateException 验证异常
*/
public static <T extends CharSequence> T validateCitizenIdNumber(final T value, final String errorMsg) throws ValidateException {
if (false == isCitizenId(value)) {
if (! isCitizenId(value)) {
throw new ValidateException(errorMsg);
}
return value;
@ -760,7 +762,7 @@ public class Validator {
* @throws ValidateException 验证异常
*/
public static <T extends CharSequence> T validateBirthday(final T value, final String errorMsg) throws ValidateException {
if (false == isBirthday(value)) {
if (! isBirthday(value)) {
throw new ValidateException(errorMsg);
}
return value;
@ -786,7 +788,7 @@ public class Validator {
* @throws ValidateException 验证异常
*/
public static <T extends CharSequence> T validateIpv4(final T value, final String errorMsg) throws ValidateException {
if (false == isIpv4(value)) {
if (! isIpv4(value)) {
throw new ValidateException(errorMsg);
}
return value;
@ -812,7 +814,7 @@ public class Validator {
* @throws ValidateException 验证异常
*/
public static <T extends CharSequence> T validateIpv6(final T value, final String errorMsg) throws ValidateException {
if (false == isIpv6(value)) {
if (! isIpv6(value)) {
throw new ValidateException(errorMsg);
}
return value;
@ -840,7 +842,7 @@ public class Validator {
* @since 4.1.3
*/
public static <T extends CharSequence> T validateMac(final T value, final String errorMsg) throws ValidateException {
if (false == isMac(value)) {
if (! isMac(value)) {
throw new ValidateException(errorMsg);
}
return value;
@ -868,7 +870,7 @@ public class Validator {
* @since 3.0.6
*/
public static <T extends CharSequence> T validatePlateNumber(final T value, final String errorMsg) throws ValidateException {
if (false == isPlateNumber(value)) {
if (! isPlateNumber(value)) {
throw new ValidateException(errorMsg);
}
return value;
@ -902,7 +904,7 @@ public class Validator {
* @throws ValidateException 验证异常
*/
public static <T extends CharSequence> T validateUrl(final T value, final String errorMsg) throws ValidateException {
if (false == isUrl(value)) {
if (! isUrl(value)) {
throw new ValidateException(errorMsg);
}
return value;
@ -939,7 +941,7 @@ public class Validator {
* @throws ValidateException 验证异常
*/
public static <T extends CharSequence> T validateChinese(final T value, final String errorMsg) throws ValidateException {
if (false == isChinese(value)) {
if (! isChinese(value)) {
throw new ValidateException(errorMsg);
}
return value;
@ -965,7 +967,7 @@ public class Validator {
* @throws ValidateException 验证异常
*/
public static <T extends CharSequence> T validateGeneralWithChinese(final T value, final String errorMsg) throws ValidateException {
if (false == isGeneralWithChinese(value)) {
if (! isGeneralWithChinese(value)) {
throw new ValidateException(errorMsg);
}
return value;
@ -993,7 +995,7 @@ public class Validator {
* @throws ValidateException 验证异常
*/
public static <T extends CharSequence> T validateUUID(final T value, final String errorMsg) throws ValidateException {
if (false == isUUID(value)) {
if (! isUUID(value)) {
throw new ValidateException(errorMsg);
}
return value;
@ -1021,7 +1023,7 @@ public class Validator {
* @since 4.3.3
*/
public static <T extends CharSequence> T validateHex(final T value, final String errorMsg) throws ValidateException {
if (false == isHex(value)) {
if (! isHex(value)) {
throw new ValidateException(errorMsg);
}
return value;
@ -1055,7 +1057,7 @@ public class Validator {
* @since 4.1.10
*/
public static void validateBetween(final Number value, final Number min, final Number max, final String errorMsg) throws ValidateException {
if (false == isBetween(value, min, max)) {
if (! isBetween(value, min, max)) {
throw new ValidateException(errorMsg);
}
}
@ -1064,7 +1066,7 @@ public class Validator {
* 检查给定的日期是否在指定范围内
*
* @param value
* @param start 最小值包含
* @param start 最小值包含
* @param end 最大值包含
* @param errorMsg 验证错误的信息
* @throws ValidateException 验证异常
@ -1075,7 +1077,7 @@ public class Validator {
Assert.notNull(start);
Assert.notNull(end);
if(false == DateUtil.isIn(value, start, end)){
if (! DateUtil.isIn(value, start, end)) {
throw new ValidateException(errorMsg);
}
}
@ -1122,7 +1124,7 @@ public class Validator {
* @since 5.6.3
*/
public static <T extends CharSequence> T validateCarVin(final T value, final String errorMsg) throws ValidateException {
if (false == isCarVin(value)) {
if (! isCarVin(value)) {
throw new ValidateException(errorMsg);
}
return value;
@ -1189,7 +1191,7 @@ public class Validator {
* @since 5.6.3
*/
public static <T extends CharSequence> T validateCarDrivingLicence(final T value, final String errorMsg) throws ValidateException {
if (false == isCarDrivingLicence(value)) {
if (! isCarDrivingLicence(value)) {
throw new ValidateException(errorMsg);
}
return value;
@ -1197,13 +1199,14 @@ public class Validator {
/**
* 验证字符的长度是否符合要求
*
* @param str 字符串
* @param min 最小长度
* @param max 最大长度
* @param errorMsg 错误消息
*/
public static void validateLength(CharSequence str, int min, int max, String errorMsg) {
int len = StrUtil.length(str);
public static void validateLength(final CharSequence str, final int min, final int max, final String errorMsg) {
final int len = StrUtil.length(str);
if (len < min || len > max) {
throw new ValidateException(errorMsg);
}
@ -1217,7 +1220,7 @@ public class Validator {
* @param max 最大长度
* @param errorMsg 错误消息
*/
public static void validateByteLength(CharSequence str, int min, int max, String errorMsg) {
public static void validateByteLength(final CharSequence str, final int min, final int max, final String errorMsg) {
validateByteLength(str, min, max, CharsetUtil.UTF_8, errorMsg);
}
@ -1230,8 +1233,8 @@ public class Validator {
* @param charset 字符编码
* @param errorMsg 错误消息
*/
public static void validateByteLength(CharSequence str, int min, int max, Charset charset, String errorMsg) {
int len = StrUtil.byteLength(str, charset);
public static void validateByteLength(final CharSequence str, final int min, final int max, final Charset charset, final String errorMsg) {
final int len = StrUtil.byteLength(str, charset);
if (len < min || len > max) {
throw new ValidateException(errorMsg);
}

View File

@ -80,7 +80,7 @@ public class CallerUtil {
public static String getCallerMethodName(final boolean isFullName){
final StackTraceElement stackTraceElement = Thread.currentThread().getStackTrace()[2];
final String methodName = stackTraceElement.getMethodName();
if(false == isFullName){
if(! isFullName){
return methodName;
}

View File

@ -135,7 +135,7 @@ public class ObjectId {
* @return objectId
*/
public static String next(final boolean withHyphen) {
if (false == withHyphen) {
if (! withHyphen) {
return next();
}
final char[] ids = new char[26];

View File

@ -359,22 +359,22 @@ public class UUID implements java.io.Serializable, Comparable<UUID> {
final StringBuilder builder = StrUtil.builder(isSimple ? 32 : 36);
// time_low
builder.append(digits(mostSigBits >> 32, 8));
if (false == isSimple) {
if (! isSimple) {
builder.append('-');
}
// time_mid
builder.append(digits(mostSigBits >> 16, 4));
if (false == isSimple) {
if (! isSimple) {
builder.append('-');
}
// time_high_and_version
builder.append(digits(mostSigBits, 4));
if (false == isSimple) {
if (! isSimple) {
builder.append('-');
}
// variant_and_sequence
builder.append(digits(leastSigBits >> 48, 4));
if (false == isSimple) {
if (! isSimple) {
builder.append('-');
}
// node

View File

@ -44,7 +44,7 @@ public abstract class AtomicLoader<T> implements Loader<T>, Serializable {
if (result == null) {
result = init();
if (false == reference.compareAndSet(null, result)) {
if (! reference.compareAndSet(null, result)) {
// 其它线程已经创建好此对象
result = reference.get();
}

View File

@ -70,7 +70,7 @@ public class NavigatePageInfo extends PageInfo {
public String toString() {
final StringBuilder str = new StringBuilder();
if (false == isFirstPage()) {
if (! isFirstPage()) {
str.append("<< ");
}
if (navigatePageNumbers.length > 0) {
@ -79,7 +79,7 @@ public class NavigatePageInfo extends PageInfo {
for (int i = 1; i < navigatePageNumbers.length; i++) {
str.append(" ").append(wrapForDisplay(navigatePageNumbers[i]));
}
if (false == isLastPage()) {
if (! isLastPage()) {
str.append(" >>");
}
return str.toString();

View File

@ -311,7 +311,7 @@ public class BoundedRange<T extends Comparable<? super T>> implements Predicate<
// 上界小于下界时为空
return compareValue > 0
// 上下界的边界值相等且不为退化区间是为空
|| false == (low.getType().isClose() && up.getType().isClose());
|| ! (low.getType().isClose() && up.getType().isClose());
}
/**

View File

@ -172,7 +172,7 @@ public class BoundedRangeOperation {
* @return 是否相交
*/
public static <T extends Comparable<? super T>> boolean isIntersected(final BoundedRange<T> boundedRange, final BoundedRange<T> other) {
return false == isDisjoint(boundedRange, other);
return ! isDisjoint(boundedRange, other);
}
/**

View File

@ -129,7 +129,7 @@ public class Range<T> implements Iterable<T>, Iterator<T>, Serializable {
}
if (null == this.next) {
return false;
} else if (false == includeEnd && this.next.equals(this.end)) {
} else if (! includeEnd && this.next.equals(this.end)) {
return false;
}
} finally {
@ -142,7 +142,7 @@ public class Range<T> implements Iterable<T>, Iterator<T>, Serializable {
public T next() {
lock.lock();
try {
if (false == this.hasNext()) {
if (! this.hasNext()) {
throw new NoSuchElementException("Has no next range!");
}
return nextUncheck();
@ -158,7 +158,7 @@ public class Range<T> implements Iterable<T>, Iterator<T>, Serializable {
final T current;
if(0 == this.index){
current = start;
if(false == this.includeStart){
if(! this.includeStart){
// 获取下一组元素
index ++;
return nextUncheck();

View File

@ -304,7 +304,7 @@ public class LinkedForestMap<K, V> implements ForestMap<K, V> {
}
// 3.子节点存在但是未与其他节点构成父子关系
if (false == childNode.hasParent()) {
if (! childNode.hasParent()) {
parentNode.addChild(childNode);
}
// 4.子节点存在且已经与其他节点构成父子关系但是允许子节点直接修改其父节点

View File

@ -152,7 +152,7 @@ public class MapProxy implements Map<Object, Object>, TypeGetter<Object>, Invoca
}
if (StrUtil.isNotBlank(fieldName)) {
if (false == this.containsKey(fieldName)) {
if (! this.containsKey(fieldName)) {
// 驼峰不存在转下划线尝试
fieldName = StrUtil.toUnderlineCase(fieldName);
}

View File

@ -65,7 +65,7 @@ public class MapUtil extends MapGetUtil {
* @return 是否为非空
*/
public static boolean isNotEmpty(final Map<?, ?> map) {
return null != map && false == map.isEmpty();
return !isEmpty(map);
}
/**
@ -174,7 +174,7 @@ public class MapUtil extends MapGetUtil {
*/
public static <K, V> TreeMap<K, V> newTreeMap(final Map<K, V> map, final Comparator<? super K> comparator) {
final TreeMap<K, V> treeMap = new TreeMap<>(comparator);
if (false == isEmpty(map)) {
if (isNotEmpty(map)) {
treeMap.putAll(map);
}
return treeMap;
@ -606,7 +606,7 @@ public class MapUtil extends MapGetUtil {
*/
public static <K, V> String join(final Map<K, V> map, final String separator, final String keyValueSeparator,
final boolean isIgnoreNull, final String... otherParams) {
return join(map, separator, keyValueSeparator, (entry) -> false == isIgnoreNull || entry.getKey() != null && entry.getValue() != null, otherParams);
return join(map, separator, keyValueSeparator, (entry) -> ! isIgnoreNull || entry.getKey() != null && entry.getValue() != null, otherParams);
}
/**

View File

@ -95,7 +95,7 @@ public class TolerantMap<K, V> extends MapWrapper<K, V> {
if (o == null || getClass() != o.getClass()) {
return false;
}
if (false == super.equals(o)) {
if (! super.equals(o)) {
return false;
}
final TolerantMap<?, ?> that = (TolerantMap<?, ?>) o;

View File

@ -1329,7 +1329,7 @@ public final class ConcurrentLinkedHashMap<K, V> extends AbstractMap<K, V>
@SuppressWarnings("unchecked")
@Override
public boolean contains(final Object obj) {
if (false == (obj instanceof Entry)) {
if (! (obj instanceof Entry)) {
return false;
}
final Entry<K, Node<K, V>> entry = (Entry<K, Node<K, V>>) obj;

View File

@ -168,7 +168,7 @@ public abstract class AbsTable<R, C, V> implements Table<R, C, V> {
@Override
public Cell<R, C, V> next() {
if (false == columnIterator.hasNext()) {
if (! columnIterator.hasNext()) {
rowEntry = rowIterator.next();
columnIterator = rowEntry.getValue().entrySet().iterator();
}

View File

@ -198,7 +198,7 @@ public class RowKeyTable<R, C, V> extends AbsTable<R, C, V> {
while (true) {
if (entryIterator.hasNext()) {
final Map.Entry<C, V> entry = entryIterator.next();
if (false == seen.containsKey(entry.getKey())) {
if (! seen.containsKey(entry.getKey())) {
seen.put(entry.getKey(), entry.getValue());
return entry.getKey();
}

View File

@ -123,7 +123,7 @@ public class Arrangement implements Serializable {
*/
private void select(final String[] datas, final String[] resultList, final int resultIndex, final List<String[]> result) {
if (resultIndex >= resultList.length) { // 全部选择完时输出排列结果
if (false == result.contains(resultList)) {
if (! result.contains(resultList)) {
result.add(Arrays.copyOf(resultList, resultList.length));
}
return;

View File

@ -51,9 +51,9 @@ public class Calculator {
final Stack<String> resultStack = new Stack<>();
Collections.reverse(postfixStack);// 将后缀式栈反转
String firstValue, secondValue, currentOp;// 参与计算的第一个值第二个值和算术运算符
while (false == postfixStack.isEmpty()) {
while (! postfixStack.isEmpty()) {
currentOp = postfixStack.pop();
if (false == isOperator(currentOp.charAt(0))) {// 如果不是运算符则存入操作数栈中
if (! isOperator(currentOp.charAt(0))) {// 如果不是运算符则存入操作数栈中
currentOp = currentOp.replace("~", "-");
resultStack.push(currentOp);
} else {// 如果是运算符则从操作数栈中取两个值和该数值一起参与运算

View File

@ -738,7 +738,7 @@ public class NumberUtil {
// two E's
return false;
}
if (false == foundDigit) {
if (! foundDigit) {
return false;
}
hasExp = true;
@ -783,7 +783,7 @@ public class NumberUtil {
}
// allowSigns is true iff the val ends in 'E'
// found digit it to make sure weird stuff like '.' and '1E-' doesn't pass
return false == allowSigns && foundDigit;
return ! allowSigns && foundDigit;
}
/**
@ -802,7 +802,7 @@ public class NumberUtil {
* @see Integer#decode(String)
*/
public static boolean isInteger(final String s) {
if (false == isNumber(s)) {
if (! isNumber(s)) {
return false;
}
try {
@ -830,7 +830,7 @@ public class NumberUtil {
* @since 4.0.0
*/
public static boolean isLong(final String s) {
if (false == isNumber(s)) {
if (! isNumber(s)) {
return false;
}
final char lastChar = s.charAt(s.length() - 1);
@ -1776,9 +1776,9 @@ public class NumberUtil {
return false;
}
if (number instanceof Double) {
return (false == ((Double) number).isInfinite()) && (false == ((Double) number).isNaN());
return (! ((Double) number).isInfinite()) && (! ((Double) number).isNaN());
} else if (number instanceof Float) {
return (false == ((Float) number).isInfinite()) && (false == ((Float) number).isNaN());
return (! ((Float) number).isInfinite()) && (! ((Float) number).isNaN());
}
return true;
}
@ -1792,7 +1792,7 @@ public class NumberUtil {
* @since 5.7.0
*/
public static boolean isValid(final double number) {
return false == (Double.isNaN(number) || Double.isInfinite(number));
return ! (Double.isNaN(number) || Double.isInfinite(number));
}
/**
@ -1804,7 +1804,7 @@ public class NumberUtil {
* @since 5.7.0
*/
public static boolean isValid(final float number) {
return false == (Float.isNaN(number) || Float.isInfinite(number));
return ! (Float.isNaN(number) || Float.isInfinite(number));
}
/**
@ -1859,6 +1859,6 @@ public class NumberUtil {
* @since 5.7.17
*/
public static boolean isEven(final int num) {
return false == isOdd(num);
return ! isOdd(num);
}
}

View File

@ -239,7 +239,7 @@ public class Ipv4Util implements Ipv4Pool {
Assert.isTrue(maskBit > IPV4_MASK_BIT_VALID_MIN && maskBit <= IPV4_MASK_BIT_MAX,
"Not support mask bit: {}", maskBit);
//如果掩码位等于32则可用地址为0
if (maskBit == IPV4_MASK_BIT_MAX && false == isAll) {
if (maskBit == IPV4_MASK_BIT_MAX && ! isAll) {
return 0;
}

View File

@ -47,7 +47,7 @@ public class LocalPortGenerator implements Serializable{
public int generate() {
int validPort = alternativePort.get();
// 获取可用端口
while (false == NetUtil.isUsableLocalPort(validPort)) {
while (! NetUtil.isUsableLocalPort(validPort)) {
validPort = alternativePort.incrementAndGet();
}
return validPort;

View File

@ -141,7 +141,7 @@ public class NetUtil {
* @return 是否可用
*/
public static boolean isUsableLocalPort(final int port) {
if (false == isValidPort(port)) {
if (! isValidPort(port)) {
// 给定的IP未在指定端口范围中
return false;
}
@ -473,7 +473,7 @@ public class NetUtil {
while (networkInterfaces.hasMoreElements()) {
final NetworkInterface networkInterface = networkInterfaces.nextElement();
if (networkInterfaceFilter != null && false == networkInterfaceFilter.test(networkInterface)) {
if (networkInterfaceFilter != null && ! networkInterfaceFilter.test(networkInterface)) {
continue;
}
final Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
@ -525,7 +525,7 @@ public class NetUtil {
public static InetAddress getLocalhost() {
final LinkedHashSet<InetAddress> localAddressList = localAddressList(address -> {
// 非loopback地址指127.*.*.*的地址
return false == address.isLoopbackAddress()
return ! address.isLoopbackAddress()
// 需为IPV4地址
&& address instanceof Inet4Address;
});
@ -533,7 +533,7 @@ public class NetUtil {
if (CollUtil.isNotEmpty(localAddressList)) {
InetAddress address2 = null;
for (final InetAddress inetAddress : localAddressList) {
if (false == inetAddress.isSiteLocalAddress()) {
if (! inetAddress.isSiteLocalAddress()) {
// 非地区本地地址指10.0.0.0 ~ 10.255.255.255172.16.0.0 ~ 172.31.255.255192.168.0.0 ~ 192.168.255.255
return inetAddress;
} else if (null == address2) {
@ -761,7 +761,7 @@ public class NetUtil {
if (ip != null && StrUtil.indexOf(ip, CharUtil.COMMA) > 0) {
final List<String> ips = SplitUtil.splitTrim(ip, StrUtil.COMMA);
for (final String subIp : ips) {
if (false == isUnknown(subIp)) {
if (! isUnknown(subIp)) {
ip = subIp;
break;
}

View File

@ -108,7 +108,7 @@ public class UploadFile {
if(null == this.tempFile){
throw new NullPointerException("Temp file is null !");
}
if(false == this.tempFile.exists()){
if(! this.tempFile.exists()){
throw new NoSuchFileException("Temp file: [" + this.tempFile.getAbsolutePath() + "] not exist!");
}
@ -277,7 +277,7 @@ public class UploadFile {
* @throws IOException IO异常
*/
private void assertValid() throws IOException {
if (false == isUploaded()) {
if (! isUploaded()) {
throw new IOException(StrUtil.format("File [{}] upload fail", getFileName()));
}
}

View File

@ -121,7 +121,7 @@ public final class UrlBuilder implements Builder<String> {
httpUrl = StrUtil.trimPrefix(httpUrl);
// issue#I66CIR
if(false == StrUtil.startWithAnyIgnoreCase(httpUrl, "http://", "https://")){
if(! StrUtil.startWithAnyIgnoreCase(httpUrl, "http://", "https://")){
httpUrl = "http://" + httpUrl;
}

View File

@ -184,7 +184,7 @@ public class UrlPath {
if (StrUtil.isEmpty(builder)) {
// 空白追加是保证以/开头
builder.append(CharUtil.SLASH);
} else if (false == StrUtil.endWith(builder, CharUtil.SLASH)) {
} else if (! StrUtil.endWith(builder, CharUtil.SLASH)) {
// 尾部没有/则追加否则不追加
builder.append(CharUtil.SLASH);
}

View File

@ -99,7 +99,7 @@ public class UrlQueryUtil {
// 无参数返回url
return urlPart;
}
} else if (false == StrUtil.contains(urlWithParams, '=')) {
} else if (! StrUtil.contains(urlWithParams, '=')) {
// 无参数的URL
return urlWithParams;
} else {

Some files were not shown because too many files have changed in this diff Show More