sealed interface List permits LinkedElem, Elem {} record LinkedElem(T a, List l) implements List {} record Elem(T a) implements List {} public class SwitchAppend {}