Java time-to-live collection Here's a class I made in java. It's pretty simple, the description of what it does is in the comment. I'd appreciate any feedback.

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

/**
 * An unordered, duplicate-allowing collection of items that are added with a
 * time-to-live, and will automatically be considered not a part of the
 * collection when that time expires. Has 0 thread overhead, and is not thread safe.
 */
public class TTLBag&lt;E&gt; implements Iterable&lt;E&gt; {

    private class Element {

        E item;
        long expires;

        Element(E item, long expires) {
            this.item = item;
            this.expires = expires;
        }

    }

    private List&lt;Element&gt; contents = new ArrayList&lt;&gt;();

    public void add(E item, long timeToLive) {
        contents.add(new Element(item, System.currentTimeMillis() + timeToLive));
    }

    @Override
    public Iterator&lt;E&gt; iterator() {
        long time = System.currentTimeMillis();
        contents.removeIf(element -&gt; element.expires &gt; time);
        return contents.stream().map(element -&gt; element.item).iterator();
    }

}
You remove the items when the iterator is requested. Are you sure that this is right in your use case? Imagine the user puts an item in with a lifetime of 20 ms, requests the iterator, gets it with this one element and uses the iterator later. Theoretically, the item would be dead then. You should mention this behavior of the iterator method. 

Additionally, the performance of the iterator construction depends on the number of dead entities inside the collection -> mention it.