Guava介绍

https://code.google.com/p/guava-libraries/wiki/GuavaExplained?tm=6

User Guide

用户指南


The Guava project contains several ofGoogle's core libraries that we rely on in our Java-based projects:collections, caching, primitives support, concurrency libraries, commonannotations, string processing, I/O, and so forth. Each of these tools really doget used every day by Googlers, in production services.

Guava项目包括几个Google的java项目都依赖的核心库,这些库包括:collections, caching, primitives support,concurrency libraries, common annotations, string processing, I/O等等。在我们的生产服务中,每天都在使用这些工具。


But trawling through Javadoc isn't alwaysthe most effective way to learn how to make best use of a library. Here, we tryto provide readable and pleasant explanations of some of the most popular andmost powerful features of Guava.

关于怎样使用这些库,查阅Javadoc不总是一个有效的学习方式。这里,我们试图以可读、舒适的方式向大家讲解Guava几个流行且强大的功能。


This wiki is a work in progress, and partsof it may still be under construction.

这个wiki是程序生成的,并且部分可能仍在构建中。

  • Basic utilities: Make using the Java language more pleasant.
  • 基础工具:使java编程变得更舒适。
    • Using and avoiding null: null can be ambiguous, can cause confusing errors, and is sometimes just plain unpleasant. Many Guava utilities reject and fail fast on nulls, rather than accepting them blindly.
    • 使用和避免null:null会引起歧义,会造成让人迷惑的错误,有时也会让人感到不爽。Guava中的许多工具遇到null时,会拒绝或者马上报错,而不是盲目的接受。
    • Preconditions: Test preconditions for your methods more easily.
    • 预置条件:使方法的条件检查更简单。
    • Common object methods: Simplify implementing Object methods, like hashCode() and toString().
    • 常用Object方法:使实现Object方法变得简单,如 hashCode()和 toString()。
    • Ordering: Guava's powerful "fluent Comparator" class.
    • 排序:Guava强大的“流式比较器”类。
    • Throwables: Simplify propagating and examining exceptions and errors.
    • Throwables使传播、检查异常和错误变得简单。
  • Collections: Guava's extensions to the JDK collections ecosystem. These are some of the most mature and popular parts of Guava.
  • 集合:Guava扩展了JDK集合体系。它们是Guava非常成熟和流行的部分。
    • Immutable collections, for defensive programming, constant collections, and improved efficiency.
    • 不可变集合:防御性编程、不变集合、以及会提升性能。
    • New collection types, for use cases that the JDK collections don't address as well as they could: multisets, multimaps, tables, bidirectional maps, and more.
    • 新集合类型:提供了一些JDK没有的集合类:multisets, multimaps, tables, bidirectional maps等等。
    • Powerful collection utilities, for common operations not provided in java.util.Collections.
    • 强大的集合工具类:提供java.util.Collections没有的常用操作。
    • Extension utilities: writing a Collection decorator? Implementing Iterator? We can make that easier.
    • 扩展工具类:写一个集合装饰器?实现Iterator?我们能使它变得简单。
  • Caches: Local caching, done right, and supporting a wide variety of expiration behaviors.
  • 缓存:本地缓存实现,并且支持多种过期策略。
  • Functional idioms: Used sparingly, Guava's functional idioms can significantly simplify code.
  • 函数式风格: Guava的函数式风格能大大简化代码,但请谨慎的使用。
  • Concurrency: Powerful, simple abstractions to make it easier to write correct concurrent code.
  • 并发:强大、简单的抽象使编写正确的并发代码变得简单。
    • ListenableFuture: Futures, with callbacks when they are finished.
    • ListenableFuture: 有回调方法的Future。
    • Service: Things that start up and shut down, taking care of the difficult state logic for you.
    • 服务:那些需要启动和停止的东西,帮你实现复杂的状态逻辑。
  • Strings: A few extremely useful string utilities: splitting, joining, padding, and more.
  • Strings:一些非常有用的String工具类,包括:分割,连接,填充等等。
  • Primitives: operations on primitive types, like int and char, not provided by the JDK, including unsigned variants for some types.
  • 原生类型:提供一些JDK没有的对原生类型的操作,例如int和char,还提供某些类型的无符号变量。
  • Ranges: Guava's powerful API for dealing with ranges on Comparable types, both continuous and discrete.
  • Ranges:Guava为可比较类型提供强大的API,包括连续和非连续的区间。
  • I/O: Simplified I/O operations, especially on whole I/O streams and files, for Java 5 and 6.
  • I/O:使Java5和6的I/O操作变得简单,特别是流和文件操作。
  • Hashing: Tools for more sophisticated hashes than what's provided by Object.hashCode(), including Bloom filters.
  • Hashing:提供比Object.hashCode()更复杂的Hash工具,以及布隆过滤器的实现。
  • EventBus: Publish-subscribe-style communication between components without requiring the components to explicitly register with one another.
  • EventBus:提供发布-订阅类型的组件通信,不需要组件明确的注册到另一个。
  • Math: Optimized, thoroughly tested math utilities not provided by the JDK.
  • Math:经过优化、彻底测试的数学工具。
  • Reflection: Guava utilities for Java's reflective capabilities.
  • 反射:Java反射工具类。
  • Tips: Getting your application working the way you want it to with Guava.
  • 提示:在你的应用中使用你想用的方式,应用Guava。
    • Philosophy: what Guava is and isn't, and our goals.
    • 理念:Guava是什么不是什么,以及我们的目标。
    • Using Guava in your build, with build systems including Maven, Gradle, and more.
    • 用Guava时的打包:使用打包工具,包括Maven,Gradle等等。
    • Using ProGuard to avoid bundling parts of Guava you don't use with your JAR.
    • 使用ProGuard避免在你的JAR中,打包你未使用的Guava部分。
    • Apache Commons equivalents, helping you translate code from using Apache Commons Collections.
    • Apache Commons 等值的,帮助你从Apache Comons集合转换代码到Guava。
    • Compatibility, details between Guava versions.
    • 兼容性,Guava版本之间的细节。
    • Idea Graveyard, feature requests that have been conclusively rejected.
    • 想法墓地,已经被拒绝的功能。
    • Friends, open-source projects we like and admire.
    • Friends,我们喜欢欣赏的开源项目。
    • HowToContribute, how to contribute to Guava.
    • 怎么贡献,怎么对Guava做贡献。

NOTE: To discuss the contents of this wiki,please just use the guava-discuss mailing list.

注意:请使用guava邮件讨论组,讨论这个wiki中的内容。

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值