Untitled
unknown
plain_text
a year ago
764 B
9
Indexable
public class Solution {
/*
A
/ | \
B C D
/\
E F
Display a node if:
1) it has been selected
2) it is an ancestor of a selected node
3) it shares the same parent as a selected node
*/
interface Node {
int getLevel();
Optional<Node> getParent();
List<Node> getChildren();
List<Node> getAncestors();
}
// Called frequently
public Iterable<Node> getDisplayed() throws Exception {
throw new UnsupportedOperationException("Implement me");
}
void handleAddSelection(Node node) {
throw new UnsupportedOperationException("Implement me");
}
void handleRemoveSelection(Node node) {
throw new UnsupportedOperationException("Implement me");
}
}Editor is loading...
Leave a Comment