indeed 面试题

原帖地址:mitbbs

实现如下两种操作。

// addMapping(“/foo/bar/x”, “XController”)
// addMapping(“/foo/bar/z”, “ZController”)
// addMapping(“/foo/baz”, “BazController”);

//getMapping(“/foo/bar/x”) -> [“XController”]
//getMapping(“/foo/bar”) -> [“XController”, “ZController”]

public void addMapping(String path, String destination) {
//candidate TODO

}

public List getMapping(String path) {
//candidate TODO

}