package com.github.mustachejava.util;

import java.util.AbstractCollection;
import java.util.Collection;
import java.util.Iterator;

/* JADX INFO: loaded from: classes.dex */
public class DecoratedCollection<T> extends AbstractCollection<Element<T>> {
    private final Collection<T> c;

    public DecoratedCollection(Collection<T> collection) {
        this.c = collection;
    }

    @Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable
    public Iterator<Element<T>> iterator() {
        final Iterator<T> it = this.c.iterator();
        return new Iterator<Element<T>>() { // from class: com.github.mustachejava.util.DecoratedCollection.1
            int index = 0;

            @Override // java.util.Iterator
            public boolean hasNext() {
                return it.hasNext();
            }

            @Override // java.util.Iterator
            public Element<T> next() {
                Object next = it.next();
                int i = this.index;
                this.index = i + 1;
                return new Element<>(i, i == 0, !it.hasNext(), next);
            }

            @Override // java.util.Iterator
            public void remove() {
                throw new UnsupportedOperationException();
            }
        };
    }

    @Override // java.util.AbstractCollection, java.util.Collection
    public int size() {
        return this.c.size();
    }
}
