2

就像是:

Ordering<Iterable<ImportXmlRecord>> comparator =
                Ordering.natural().lexicographical().onResultOf();

但是按 ImportXmlRecord 字段排序?

4

1 回答 1

3

不完全的:

Ordering<Iterable<ImportXmlRecord>> comparator = Ordering.natural()
  .onResultOf(new Function<ImportXmlRecord, Whatever>() {
    public Whatever apply(ImportXmlRecord x) { return x.getWhatever(); }
  }.lexicographical();
于 2012-08-26T22:52:31.400 回答