/*
 * 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.plugin.mongodb;

import io.prestosql.spi.type.ArrayType;
import io.prestosql.spi.type.MapType;
import io.prestosql.spi.type.RowType;
import io.prestosql.spi.type.Type;

import java.util.function.Predicate;

import static io.prestosql.spi.type.DateType.DATE;
import static io.prestosql.spi.type.TimeType.TIME;
import static io.prestosql.spi.type.TimestampType.TIMESTAMP;
import static io.prestosql.spi.type.TimestampWithTimeZoneType.TIMESTAMP_WITH_TIME_ZONE;

public final class TypeUtils
{
    private TypeUtils() {}

    public static boolean isArrayType(Type type)
    {
        return type instanceof ArrayType;
    }

    public static boolean isMapType(Type type)
    {
        return type instanceof MapType;
    }

    public static boolean isRowType(Type type)
    {
        return type instanceof RowType;
    }

    public static boolean isDateType(Type type)
    {
        return type.equals(DATE) ||
                type.equals(TIME) ||
                type.equals(TIMESTAMP) ||
                type.equals(TIMESTAMP_WITH_TIME_ZONE);
    }

    public static boolean containsType(Type type, Predicate<Type> predicate, Predicate<Type>... orPredicates)
    {
        for (Predicate<Type> orPredicate : orPredicates) {
            predicate = predicate.or(orPredicate);
        }
        if (predicate.test(type)) {
            return true;
        }

        return type.getTypeParameters().stream().anyMatch(predicate);
    }
}

@@ -749,298 +749,8 @@
 e;%0A%0A
-import java.util.function.Predicate;%0A%0Aimport static io.prestosql.spi.type.DateType.DATE;%0Aimport static io.prestosql.spi.type.TimeType.TIME;%0Aimport static io.prestosql.spi.type.TimestampType.TIMESTAMP;%0Aimport static io.prestosql.spi.type.TimestampWithTimeZoneType.TIMESTAMP_WITH_TIME_ZONE;%0A%0A
 publ
@@ -1110,623 +1110,7 @@
    %7D
-%0A%0A    public static boolean isDateType(Type type)%0A    %7B%0A        return type.equals(DATE) %7C%7C%0A                type.equals(TIME) %7C%7C%0A                type.equals(TIMESTAMP) %7C%7C%0A                type.equals(TIMESTAMP_WITH_TIME_ZONE);%0A    %7D%0A%0A    public static boolean containsType(Type type, Predicate%3CType%3E predicate, Predicate%3CType%3E... orPredicates)%0A    %7B%0A        for (Predicate%3CType%3E orPredicate : orPredicates) %7B%0A            predicate = predicate.or(orPredicate);%0A        %7D%0A        if (predicate.test(type)) %7B%0A            return true;%0A        %7D%0A%0A        return type.getTypeParameters().stream().anyMatch(predicate);%0A    %7D
 %0A%7D%0A

Remove unused methods from MongoDB TypeUtils