这里的案例是构建术语,但这里的案例是行是documentIds,列是术语。
如何使用Java泛型集合实现这一点?到目前为止,我已经尝试过了:
class Matrix {
HashMap<Point, Integer> map = new HashMap<>();
Matrix(row, col, frequency) {
map.put(new Point(row, col), frequency);
}
}哪里
class Point { Document row, Term col; }
class Document { String documentId }
class Term { String term }术语按字母顺序排序。通过使用这些代码,我认为如果在某些文档中有新的术语,将很难同步每个点。
所以我的问题是,如何构建支持这种行为的集合?
发布于 2016-03-04 13:24:19
不要重复发明轮子。这一切都是以前做过的。请参阅Guava Table interface and implementations。
https://stackoverflow.com/questions/35765374
复制相似问题