All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opendaylight.yangtools.util.UIOMv1 Maven / Gradle / Ivy

There is a newer version: 14.0.4
Show newest version
/*
 * Copyright (c) 2022 PANTHEON.tech, s.r.o. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */
package org.opendaylight.yangtools.util;

import com.google.common.collect.ImmutableList;
import java.io.Serial;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.util.ImmutableOffsetMap.Unordered;

/**
 * Serialization proxy for {@link Unordered}.
 */
final class UIOMv1 extends IOMv1> {
    @Serial
    private static final long serialVersionUID = 1;

    @SuppressWarnings("checkstyle:RedundantModifier")
    public UIOMv1() {
        // For Externalizable
    }

    UIOMv1(final @NonNull Unordered map) {
        super(map);
    }

    @Override
    Unordered createInstance(final ImmutableList keys, final Object[] values) {
        final var newOffsets = OffsetMapCache.unorderedOffsets(keys);
        return new Unordered<>(newOffsets, OffsetMapCache.adjustedArray(newOffsets, keys, values));
    }
}