[jOOQ/jOOQ#14251] Refactor !anyMatch(l, x -> !t) to allMatch(l, x -> t)
This commit is contained in:
parent
25d902d7f6
commit
980d1d3fc7
@ -54,6 +54,7 @@ import static org.jooq.impl.ConstraintType.FOREIGN_KEY;
|
||||
import static org.jooq.impl.ConstraintType.PRIMARY_KEY;
|
||||
import static org.jooq.impl.ConstraintType.UNIQUE;
|
||||
import static org.jooq.impl.Tools.NO_SUPPORT_TIMESTAMP_PRECISION;
|
||||
import static org.jooq.impl.Tools.allMatch;
|
||||
import static org.jooq.impl.Tools.anyMatch;
|
||||
import static org.jooq.tools.StringUtils.defaultIfNull;
|
||||
import static org.jooq.tools.StringUtils.defaultString;
|
||||
|
||||
@ -51,6 +51,7 @@ import static org.jooq.impl.DSL.schema;
|
||||
import static org.jooq.impl.FieldsImpl.fieldsRow0;
|
||||
import static org.jooq.impl.SQLDataType.BIGINT;
|
||||
import static org.jooq.impl.Tools.EMPTY_FIELD;
|
||||
import static org.jooq.impl.Tools.allMatch;
|
||||
import static org.jooq.impl.Tools.anyMatch;
|
||||
import static org.jooq.impl.Tools.apply;
|
||||
import static org.jooq.impl.Tools.dataTypes;
|
||||
@ -1862,7 +1863,7 @@ final class Interpreter {
|
||||
if (fields.size() != f.length)
|
||||
return false;
|
||||
else
|
||||
return !anyMatch(fields, (x, i) -> !x.nameEquals((UnqualifiedName) f[i].getUnqualifiedName()));
|
||||
return allMatch(fields, (x, i) -> x.nameEquals((UnqualifiedName) f[i].getUnqualifiedName()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2507,8 +2507,6 @@ package org.jooq.impl;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -40,12 +40,10 @@ package org.jooq.impl;
|
||||
import static org.jooq.Name.Quoted.DEFAULT;
|
||||
import static org.jooq.Name.Quoted.MIXED;
|
||||
// ...
|
||||
import static org.jooq.impl.Tools.anyMatch;
|
||||
import static org.jooq.impl.Tools.allMatch;
|
||||
import static org.jooq.impl.Tools.map;
|
||||
import static org.jooq.impl.Tools.stringLiteral;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.jooq.Context;
|
||||
import org.jooq.Name;
|
||||
import org.jooq.tools.StringUtils;
|
||||
@ -188,7 +186,7 @@ final class QualifiedName extends AbstractName {
|
||||
|
||||
@Override
|
||||
public final boolean empty() {
|
||||
return !anyMatch(qualifiedName, n -> !n.empty());
|
||||
return allMatch(qualifiedName, n -> n.empty());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -40,6 +40,7 @@ package org.jooq.impl;
|
||||
|
||||
import static java.lang.Boolean.TRUE;
|
||||
import static org.jooq.impl.Tools.EMPTY_QUERYPART;
|
||||
import static org.jooq.impl.Tools.allMatch;
|
||||
import static org.jooq.impl.Tools.anyMatch;
|
||||
import static org.jooq.impl.Tools.isRendersSeparator;
|
||||
import static org.jooq.impl.Tools.last;
|
||||
@ -131,7 +132,7 @@ permits
|
||||
|
||||
@Override
|
||||
public boolean isSimple(Context<?> ctx) {
|
||||
return !anyMatch(this, e -> !Tools.isSimple(ctx, e));
|
||||
return allMatch(this, e -> Tools.isSimple(ctx, e));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -189,6 +189,7 @@ import static org.jooq.impl.SQLDataType.VARCHAR;
|
||||
import static org.jooq.impl.SQLDataType.XML;
|
||||
import static org.jooq.impl.Tools.aliased;
|
||||
import static org.jooq.impl.Tools.aliasedFields;
|
||||
import static org.jooq.impl.Tools.allMatch;
|
||||
import static org.jooq.impl.Tools.anyMatch;
|
||||
import static org.jooq.impl.Tools.autoAlias;
|
||||
import static org.jooq.impl.Tools.camelCase;
|
||||
|
||||
@ -39,6 +39,7 @@
|
||||
package org.jooq.impl;
|
||||
|
||||
import static org.jooq.SortOrder.DESC;
|
||||
import static org.jooq.impl.Tools.allMatch;
|
||||
import static org.jooq.impl.Tools.anyMatch;
|
||||
|
||||
import java.util.List;
|
||||
@ -74,7 +75,7 @@ final class SortFieldList extends QueryPartList<SortField<?>> {
|
||||
* all {@link SortOrder#ASC} or all {@link SortOrder#DESC}.
|
||||
*/
|
||||
final boolean uniform() {
|
||||
return !anyMatch(this, f -> (f.getOrder() == DESC) != (get(0).getOrder() == DESC));
|
||||
return allMatch(this, f -> (f.getOrder() == DESC) == (get(0).getOrder() == DESC));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -43,7 +43,7 @@ import static org.jooq.impl.DSL.name;
|
||||
import static org.jooq.impl.DefaultDataType.getDataType;
|
||||
import static org.jooq.impl.SQLDataType.VARCHAR;
|
||||
import static org.jooq.impl.Tools.EMPTY_FIELD;
|
||||
import static org.jooq.impl.Tools.anyMatch;
|
||||
import static org.jooq.impl.Tools.allMatch;
|
||||
import static org.jooq.impl.Tools.fields;
|
||||
import static org.jooq.impl.Tools.newRecord;
|
||||
import static org.jooq.impl.Tools.row0;
|
||||
@ -344,7 +344,7 @@ final class XMLHandler<R extends Record> extends DefaultHandler {
|
||||
if (fields.size() <= 1)
|
||||
return false;
|
||||
else
|
||||
return !anyMatch(fields, f -> !"value".equalsIgnoreCase(f.getName()));
|
||||
return allMatch(fields, f -> "value".equalsIgnoreCase(f.getName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Loading…
Reference in New Issue
Block a user