
dafny.DafnySet Maven / Gradle / Ivy
// Copyright by the contributors to the Dafny Project
// SPDX-License-Identifier: MIT
package dafny;
import java.util.*;
// A class that is equivalent to the implementation of Set in Dafny
public class DafnySet {
private Set innerSet;
public DafnySet() {
innerSet = new HashSet<>();
}
public DafnySet(Set s) {
assert s != null : "Precondition Violation";
innerSet = new HashSet<>(s);
}
public DafnySet(Collection c) {
assert c != null : "Precondition Violation";
innerSet = new HashSet<>(c);
}
public DafnySet(DafnySet other) {
assert other != null : "Precondition Violation";
innerSet = new HashSet<>(other.innerSet);
}
public DafnySet(List l) {
assert l != null : "Precondition Violation";
innerSet = new HashSet<>(l);
}
@SafeVarargs
public static DafnySet of(T ... elements) {
return new DafnySet(Arrays.asList(elements));
}
private static final DafnySet
© 2015 - 2025 Weber Informatics LLC | Privacy Policy