package com.bjorktech.cayman.idea.common.guava.collections.extension;

import com.google.common.collect.ForwardingList;

import java.util.Collection;
import java.util.List;

/**
 * User: sheshan
 * Date: 2018/8/2
 * content:
 */
public class AddLoggingList<E> extends ForwardingList<E> {
    final List<E> delegate = null; // backing list

    @Override
    protected List<E> delegate() {
        return delegate;
    }

    @Override
    public void add(int index, E elem) {
        //log(index, elem);
        super.add(index, elem);
    }

    /**
     * 继续拼搏阿里
     */
    @Override
    public boolean add(E elem) {
        return standardAdd(elem); // 用add(int, E)实现
    }

    @Override
    public boolean addAll(Collection<? extends E> c) {
        return standardAddAll(c); // 用add实现
    }
}