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

org.solovyev.common.collections.multiset.SynchronizedOneInstanceMultiSet Maven / Gradle / Ivy

There is a newer version: 1.0.3
Show newest version
package org.solovyev.common.collections.multiset;

import org.jetbrains.annotations.NotNull;

/**
 * User: serso
 * Date: 7/9/12
 * Time: 4:17 PM
 */
public class SynchronizedOneInstanceMultiSet extends SynchronizedMultiSet implements OneInstanceMultiSet {

    public SynchronizedOneInstanceMultiSet(@NotNull OneInstanceMultiSet delegate) {
        super(delegate);
    }

    public SynchronizedOneInstanceMultiSet(@NotNull OneInstanceMultiSet delegate, @NotNull Object mutex) {
        super(delegate, mutex);
    }

    @NotNull
    @Override
    protected OneInstanceMultiSet delegate() {
        return (OneInstanceMultiSet) super.delegate();
    }

    @Override
    public int setCount(E e, int count) {
        synchronized (mutex) {
            return delegate().setCount(e, count);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy