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

org.aksw.commons.collection.observable.DeltaCollectionBase Maven / Gradle / Ivy

There is a newer version: 0.9.9
Show newest version
package org.aksw.commons.collection.observable;

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

/**
 * Abstract base implementation of {@link DeltaCollection} that delegates all mutation
 * methods to {@link #delta(Collection, Collection)}.
 *
 * @author raven
 *
 * @param 
 * @param 
 */
public abstract class DeltaCollectionBase>
    extends AbstractCollection
    implements DeltaCollection
{
    @Override
    public boolean add(T value) {
        return addAll(Collections.singleton(value));
    }

    @Override
    public boolean addAll(Collection addedItems) {
        return delta(addedItems, Collections.emptySet());

    }

    @Override
    public void clear() {
        removeAll(this);
    }

    @Override
    public boolean remove(Object o) {
        return removeAll(Collections.singleton(o));
    }


    @Override
    public boolean removeAll(Collection c) {
        return delta(Collections.emptySet(), c);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy