com.github.grignaak.collections.CowTreeSet Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cow-collections Show documentation
Show all versions of cow-collections Show documentation
Copy-on-write collections for easy, thread-safe, immutability
package com.github.grignaak.collections;
import java.util.Comparator;
public class CowTreeSet extends AbstractMapBackedSet implements CowSet {
private final CowTreeMap impl;
public CowTreeSet(Comparator comparator) {
this(new CowTreeMap<>(comparator));
}
private CowTreeSet(CowTreeMap impl) {
this.impl = impl;
}
@Override
protected CowMap backingMap() {
return impl;
}
/**
* {@inheritDoc}
*/
@Override
public CowTreeSet fork() {
return new CowTreeSet<>(impl.fork());
}
}