1class Node {
2
3}
4
5class ClassCast {
6
7    public static <N extends Node> List<N> getNodesByType(Node container, Class<N> clazz) {
8        List<N> nodes = new ArrayList<N>();
9        Node child;
10        return clazz.cast(child);
11    }
12
13}