// Path: json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/ArrayUtils.java
// static List<Boolean> toBoolList(boolean[] source) {
//     List<Boolean> result = new ArrayList<>(source.length);
//     for (boolean value : source) {
//         result.add(value);
//     }
//     return result;
// }
// 
// Path: json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/ArrayUtils.java
// static List<Double> toDoubleList(double[] source) {
//     return Arrays.stream(source).boxed().collect(toList());
// }
// 
// Path: json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/ArrayUtils.java
// static List<Integer> toIntList(int[] source) {
//     return Arrays.stream(source).boxed().collect(toList());
// }


import org.jetbrains.annotations.NotNull;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import static net.javacrumbs.jsonunit.core.internal.ArrayUtils.toBoolList;
import static net.javacrumbs.jsonunit.core.internal.ArrayUtils.toDoubleList;
import static net.javacrumbs.jsonunit.core.internal.ArrayUtils.toIntList;
/**
 * Copyright 2009-2019 the original author or authors.
 *
 * 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 net.javacrumbs.jsonunit.core.internal;




class GenericNodeBuilder implements NodeBuilder {
    private static final GenericNodeBuilder INSTANCE = new GenericNodeBuilder();

    static Node wrapDeserializedObject(Object object) {
        return INSTANCE.newNode(object);
    }

    @Override
    @SuppressWarnings("unchecked")
    public Node newNode(Object object) {
        if (object == null) {
            return new NullNode();
        } else if (object instanceof Map) {
            return new ObjectNode((Map<String, Object>) object, this);
        } else if (object instanceof Number) {
            return new NumberNode((Number) object);
        } else if (object instanceof String) {
            return new StringNode((String) object);
        } else if (object instanceof Boolean) {
            return new BooleanNode((Boolean) object);
        } else if (object instanceof Object[]) {
            return new ArrayNode(Arrays.asList((Object[]) object), this);
        } else if (object instanceof int[]) {
            return new ArrayNode(toIntList((int[]) object), this);
        } else if (object instanceof double[]) {
            return new ArrayNode(toDoubleList((double[]) object), this);
        } else if (object instanceof boolean[]) {
// Path: json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/ArrayUtils.java
// static List<Boolean> toBoolList(boolean[] source) {
//     List<Boolean> result = new ArrayList<>(source.length);
//     for (boolean value : source) {
//         result.add(value);
//     }
//     return result;
// }
// 
// Path: json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/ArrayUtils.java
// static List<Double> toDoubleList(double[] source) {
//     return Arrays.stream(source).boxed().collect(toList());
// }
// 
// Path: json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/ArrayUtils.java
// static List<Integer> toIntList(int[] source) {
//     return Arrays.stream(source).boxed().collect(toList());
// }


// Path: json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/GenericNodeBuilder.java
import org.jetbrains.annotations.NotNull;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import static net.javacrumbs.jsonunit.core.internal.ArrayUtils.toBoolList;
import static net.javacrumbs.jsonunit.core.internal.ArrayUtils.toDoubleList;
import static net.javacrumbs.jsonunit.core.internal.ArrayUtils.toIntList;

/**
 * Copyright 2009-2019 the original author or authors.
 *
 * 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 net.javacrumbs.jsonunit.core.internal;




class GenericNodeBuilder implements NodeBuilder {
    private static final GenericNodeBuilder INSTANCE = new GenericNodeBuilder();

    static Node wrapDeserializedObject(Object object) {
        return INSTANCE.newNode(object);
    }

    @Override
    @SuppressWarnings("unchecked")
    public Node newNode(Object object) {
        if (object == null) {
            return new NullNode();
        } else if (object instanceof Map) {
            return new ObjectNode((Map<String, Object>) object, this);
        } else if (object instanceof Number) {
            return new NumberNode((Number) object);
        } else if (object instanceof String) {
            return new StringNode((String) object);
        } else if (object instanceof Boolean) {
            return new BooleanNode((Boolean) object);
        } else if (object instanceof Object[]) {
            return new ArrayNode(Arrays.asList((Object[]) object), this);
        } else if (object instanceof int[]) {
            return new ArrayNode(toIntList((int[]) object), this);
        } else if (object instanceof double[]) {
            return new ArrayNode(toDoubleList((double[]) object), this);
        } else if (object instanceof boolean[]) {
            return new ArrayNode(toBoolList((boolean[]) object), this);