2013年9月24日
摘要: 概述CompoundOrdering是Ordering的子类,它用来存储比较器链, Ordering的compound()内部实现就是使用CompoundOrdering(Comparator primary, Comparator secondary)方法来实现的代码/** An ordering that tries several comparators in order. */@GwtCompatible(serializable = true)final class CompoundOrdering extends Ordering imple... 阅读全文
posted @ 2013-09-24 20:54 ZimZz 阅读(776) 评论(0) 推荐(0) 编辑
摘要: TODO: rewrite with more examplesGuava'sThrowablesutility can frequently simplify dealing with exceptions.Propagation 传播Sometimes, when you catch an exception, you want to throw it back up to the next try/catch block. This is frequently the case forRuntimeExceptionorErrorinstances, which do not r 阅读全文
posted @ 2013-09-24 18:13 ZimZz 阅读(917) 评论(0) 推荐(0) 编辑
摘要: 概述ClassToInstanceMap提供了一种是用Class作为Key, 对应实例作为Value的途径.他定义了T getInstance(Class)和T putInstance(Class T)两个方法, 这两个方法消除了元素类型转换的过程并保证了元素在Map中是类型安全的.ClassToInstanceMap有一个独立的类型参数, 一般命名为B. 它对应着Map的元素的类型的最大上界.例如ClassToInstanceMap numberDefaults = MutableClassToInstanceMap.create();numberDefaults.putInstance(I 阅读全文
posted @ 2013-09-24 00:49 ZimZz 阅读(3112) 评论(0) 推荐(0) 编辑