guava20.0發佈

上個月,guava正式發佈了20.0版本,在升級guava版本時需要關注一下更新的內容。
更新概況
common.graph
新添加了一個common.graph包,主要用來處理基於圖的數據結構數據,詳見:https://github.com/google/guava/wiki/GraphsExplained

common.base
1.CharMatcher相比19.0棄用了一些方法,並且在2年內會將棄用的方法移除.
2.Preconditions中checkNonNull和checkState有變化
3.Throwables新添加了方法和棄用了一些方法

common.collect

1.ConcurrentHashMultiset: create(MapMaker) 棄用,添加create(ConcurrentMap) 方法.
2.FluentIterable: 添加了一些新的靜態方法,例如:concat(Iterable) 和 of().
3.Iterators: 移除了棄用的方法emptyIterator()
4.MapConstraints: 很多方法被刪除,後續會去除這個類.
5.Maps: 添加subMap(NavigableMap, Range).
6.Ordering: 棄用binarySearch.
7.RangeSet: 添加intersects(Range).
8.Sets: 添加subSet(NavigableSet, Range).
9.TreeTraverser: 添加using(Function).

common.hash
Hashing: 添加了一些新的hash函數: FarmHash 、Fingerprint64 、HMAC 算法.

common.io
1.移除InputSupplier 和OutputSupplier.
2.BaseEncoding: 新增canDecode(CharSequence).
3.ByteStreams: 新增exhaust(InputStream).
4.CharSource: 新增asByteSource(Charset).
5.CharStreams: 新增exhaust(Readable).

common.math
1.主要添加了一些統計相關的類:
Quantiles
Stats and StatsAccumulator, PairedStats and PairedStatsAccumulator
LinearTransformation
2. IntMath, LongMath 和 DoubleMath 添加了一些方法,例如:
ceilingPowerOfTwo
isPrime

common.net
1.HostAndPort: 棄用getHostText(),添加新的方法getHost()代替該方法.
2.HttpHeaders and MediaType: 添加了一些新的header/media type常量.

common.reflect
1.ClassPath.ResourceInfo: 添加asByteSource() 和 asCharSource(Charset).
2.TypeToken: 刪除isAssignableFrom,在19.0中添加了替代方法isSubtypeOf.

common.util.concurrent
1.FutureFallback: 刪除.
2.Futures.withFallback 刪除
3.AsyncCallable: 新增.
4.新增Callables.asAsyncCallable(Callable, ListeningExecutorService).
5.Futures.FutureCombiner: 新增.
6.Futures.whenAllComplete 和 whenAllSucceed, 添加返回類型FutureCombiner.
7.AbstractFuture: 新增回調afterDone() .
8.AtomicLongMap: 新增removeIfZero(K).
9.Futures:
刪除get,使用getChecked替換.
刪除transform方法; 使用transformAsync替換.
getDone(Future) 新增.

閱讀官方文檔

更多內容關注微信公衆號:qunzi-eros
這裏寫圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章