com.ajjpj.afoundation.collection.immutable.ABTreeSet Maven / Gradle / Ivy
The newest version!
package com.ajjpj.afoundation.collection.immutable;
/**
* @author arno
*/
public class ABTreeSet extends MapAsSetWrapper> {
public static ABTreeSet empty (ABTreeSpec spec) {
return new ABTreeSet<> (ABTreeMap. empty (spec));
}
@SuppressWarnings ("unchecked")
public static ABTreeSet create (ABTreeSpec spec, T... elements) {
return create (spec, elements);
}
public static ABTreeSet create (ABTreeSpec spec, Iterable elements) {
ABTreeSet result = empty (spec);
for (T el: elements) {
result = result.added (el);
}
return result;
}
public static ABTreeSet create (ABTreeMap inner) {
return new ABTreeSet<> (inner);
}
private ABTreeSet (AMap inner) {
super (inner);
}
@Override protected ABTreeSet wrapAsSet (AMap inner) {
return new ABTreeSet<> (inner);
}
}