Google Guava: How to use ImmutableSortedMap.naturalOrder?
问题 I'm using Google Guava r08 and JDK 1.6.0_23. I want to create an ImmutableSortedMap using a builder. I know I can create the builder like this: ImmutableSortedMap.Builder<Integer, String> b1 = new ImmutableSortedMap.Builder<Integer, String>(Ordering.natural()); and then use that to build maps, for example: ImmutableSortedMap<Integer, String> map = b1.put(1, "one").put(2, "two").put(3, "three").build(); I noticed that class ImmutableSortedMap has a method naturalOrder() that returns a Builder