Files
JavaCompilerCore/resources/bytecode/javFiles/PatternMatchingJava.jav
dholle 2f7e4fc1e4
SonarQube Scan / SonarQube Trigger (push) Failing after 1m51s
WIP
2026-04-30 14:28:35 +02:00

25 lines
718 B
Java

import java.lang.Object;
import List;
import Cons;
import Empty;
import Pair;
public class PatternMatchingJava {
public <A, B> Cons<Pair<A, B>> zip(Cons<A> a, Cons<B> b) {
switch (a) {
case Cons(x, Cons xs) -> {
switch (b) {
case Cons(y, Cons ys) -> { return new Cons<>(new Pair<>(x, y), zip(xs, ys)); }
};
}
case Cons(x, Empty xs) -> {
switch (b) {
case Cons(y, Empty ys) -> { return new Cons<>(new Pair<>(x, y), zip(xs, ys)); }
};
}
};
}
public <A, B> Empty<Pair<A, B>> zip(Empty<A> a, Empty<B>) {
return new Empty<>();
}
}