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

tech.ytsaurus.ysontree.YTreeListNodeImpl Maven / Gradle / Ivy

The newest version!
package tech.ytsaurus.ysontree;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import javax.annotation.Nullable;

public class YTreeListNodeImpl extends YTreeNodeImpl implements YTreeListNode {

    private final List list = new ArrayList<>();

    public YTreeListNodeImpl(@Nullable Map attributes) {
        super(attributes);
    }

    @Override
    public int size() {
        return list.size();
    }

    @Override
    public void clear() {
        list.clear();
    }

    @Override
    public YTreeNode get(int index) {
        return list.get(index);
    }

    @Override
    public YTreeNode set(int index, YTreeNode value) {
        return list.set(index, value);
    }

    @Override
    public YTreeNode remove(int index) {
        return list.remove(index);
    }

    @Override
    public void add(YTreeNode value) {
        list.add(value);
    }

    @Override
    public void addAll(List values) {
        list.addAll(values);
    }

    @Override
    public Iterator iterator() {
        return list.iterator();
    }

    @Override
    public List asList() {
        return list;
    }

    @Override
    public int hashCode() {
        return hashCodeBase() * 4243 + list.hashCode();
    }

    @Override
    public boolean equals(Object another) {
        if (this == another) {
            return true;
        }
        if (another == null || !(another instanceof YTreeListNode)) {
            return false;
        }
        YTreeListNode node = (YTreeListNode) another;
        return list.equals(node.asList()) && equalsBase(node);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy