org.pure4j.collections.TransientTreeSet Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pure4j-core Show documentation
Show all versions of pure4j-core Show documentation
Pure Functional Programming Semantics For Java
package org.pure4j.collections;
import java.util.Comparator;
import java.util.TreeSet;
public class TransientTreeSet extends TreeSet implements ITransientSet {
public TransientTreeSet() {
super();
}
public TransientTreeSet(Comparator super T> comparator) {
super(comparator);
}
public TransientTreeSet(Comparator super T> comparator, ISeq items) {
super(comparator);
for (T t : items) {
add(t);
}
}
@Override
public IPersistentSet persistent() {
IPersistentSet out = (IPersistentSet) PersistentTreeSet.create(comparator());
for (T t : this) {
out = out.cons(t);
}
return out;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy