org.solovyev.common.collections.multiset.SynchronizedOneInstanceMultiSet Maven / Gradle / Ivy
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);
}
}
}