/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.prestosql.testing;

import org.testng.annotations.DataProvider;

import java.util.ArrayList;
import java.util.stream.Collector;

public final class DataProviders
{
    private DataProviders() {}

    public static <T> Collector<T, ?, Object[][]> toDataProvider()
    {
        return Collector.of(
                ArrayList::new,
                (builder, entry) -> builder.add(new Object[] {entry}),
                (left, right) -> {
                    left.addAll(right);
                    return left;
                },
                builder -> builder.toArray(new Object[][] {}));
    }

    @DataProvider
    public static Object[][] trueFalse()
    {
        return new Object[][] {{true}, {false}};
    }
}

@@ -648,25 +648,145 @@
 va.util.
-ArrayList
+stream.Collector;%0A%0Aimport static java.util.stream.Collectors.collectingAndThen;%0Aimport static java.util.stream.Collectors.mapping
 ;%0Aimport
@@ -778,32 +778,39 @@
 mapping;%0Aimport 
+static 
 java.util.stream
@@ -819,16 +819,24 @@
 ollector
+s.toList
 ;%0A%0Apubli
@@ -989,20 +989,25 @@
 urn 
-C
+c
 ollect
-or.of
+ingAndThen
 (%0A  
@@ -1024,23 +1024,16 @@
     
-ArrayList::new,
+mapping(
 %0A   
@@ -1049,40 +1049,25 @@
     
-(builder, entry) -%3E builder.add(
+        value -%3E 
 new 
@@ -1080,15 +1080,14 @@
 %5B%5D %7B
-entry%7D)
+value%7D
 ,%0A  
@@ -1104,153 +1104,55 @@
     
-(left, right) -%3E %7B%0A                    left.addAll(right);%0A                    return left;%0A                %7D,%0A                builder -%3E builder
+        toList()),%0A                list -%3E list
 .toA

Simplify collector definition