org.pure4j.collections.TransientHashSet 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.Collection;
import java.util.HashSet;
import org.pure4j.Pure4J;
import org.pure4j.annotations.pure.Enforcement;
import org.pure4j.annotations.pure.Pure;
import org.pure4j.annotations.pure.PureParameters;
public class TransientHashSet extends HashSet implements ITransientSet {
public TransientHashSet() {
super();
}
@PureParameters(Enforcement.NOT_PURE)
public TransientHashSet(Collection extends T> c) {
super(c);
}
public TransientHashSet(int initialCapacity, float loadFactor) {
super(initialCapacity, loadFactor);
}
public TransientHashSet(int initialCapacity) {
super(initialCapacity);
}
@Override
public IPersistentSet persistent() {
return new PersistentHashSet(this);
}
@Override
public boolean contains(Object o) {
Pure4J.immutable(o);
return super.contains(o);
}
@Override
public boolean add(T e) {
Pure4J.immutable(e);
return super.add(e);
}
@Override
public boolean remove(Object o) {
Pure4J.immutable(o);
return super.remove(o);
}
@Override
public boolean removeAll(Collection> c) {
Pure4J.immutable(c);
return super.removeAll(c);
}
@Pure(value=Enforcement.FORCE)
@Override
public T[] toArray(T[] a) {
return super.toArray(a);
}
@Override
public boolean containsAll(Collection> c) {
Pure4J.immutable(c);
return super.containsAll(c);
}
@Override
public boolean addAll(Collection extends T> c) {
Pure4J.immutable(c);
return super.addAll(c);
}
@Override
public boolean retainAll(Collection> c) {
Pure4J.immutable(c);
return super.retainAll(c);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy