Skip to content

Commit e6f289a

Browse files
committed
Apply the value transform immediately on construction
This will allow the rendering decision to be accurate
1 parent 723f20e commit e6f289a

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

.github/dependabot.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
#
2+
# Copyright 2016-2020 the original author or authors.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
117
version: 2
218
updates:
319
- package-ecosystem: maven

src/main/java/org/mybatis/dynamic/sql/AbstractListValueCondition.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
*/
1616
package org.mybatis.dynamic.sql;
1717

18-
import java.util.ArrayList;
1918
import java.util.Collection;
2019
import java.util.Objects;
2120
import java.util.function.Function;
2221
import java.util.function.UnaryOperator;
22+
import java.util.stream.Collectors;
2323
import java.util.stream.Stream;
2424

2525
public abstract class AbstractListValueCondition<T> implements VisitableCondition<T> {
@@ -32,12 +32,13 @@ protected AbstractListValueCondition(Collection<T> values) {
3232
}
3333

3434
protected AbstractListValueCondition(Collection<T> values, UnaryOperator<Stream<T>> valueStreamTransformer) {
35-
this.values = new ArrayList<>(Objects.requireNonNull(values));
3635
this.valueStreamTransformer = Objects.requireNonNull(valueStreamTransformer);
36+
this.values = valueStreamTransformer.apply(Objects.requireNonNull(values).stream())
37+
.collect(Collectors.toList());
3738
}
3839

3940
public final <R> Stream<R> mapValues(Function<T, R> mapper) {
40-
return valueStreamTransformer.apply(values.stream()).map(mapper);
41+
return values.stream().map(mapper);
4142
}
4243

4344
@Override

0 commit comments

Comments
 (0)