Recently learned the use of the next guava, here is a simple record of some commonly used and use of the tool class.See the use of the table is really a bright, before the code has written a lot of map This format of code, this reading is very unfriendly, I don't even know what the key in the map is, but it's the context Association, and the presence of the table type completely solves the problem.Table supports row, column, value we think of the map
Guava Study Notes: Object encapsulation operations in guavaReprint: Http://outofmemory.cn/java/guava/base/ObjectsWe often need to compare two objects for equality in development, when we need to consider whether the comparison of two objects is null, and then call the Equals method to compare equality, Google The Com.google.common.base.Objects class of the guava
1, this article translates from the http://eclipsesource.com/blogs/2012/06/06/cleaner-code-with-guava-optionals-and-preconditions/, has said the wrong place , Welcome to treatise.2, when I developed software, towards clean code development is my privilege, for some time, I have used in almost all of my projects Google melon (Google guava), the reason is very simple, gua
Guava introduces some new collection types that are not available in JDK, but are very useful. All these new collection types can be smoothly integrated with the collection in JDK. The Guava set accurately implements the JDK-defined interfaces. The new set defined in Guava includes:MultisetSortedMultisetMultimapListMultimapSetMultimapBiMapClassToInstanceMapTable
business are increased, and the code you write becomes less readable. Then we can consider using the bimap in guava. Bimap Bimap is very simple to use, for the above use of the scenario, we can use a very simple code to achieve: @Test public void Bimaptest () {bimap Mandatory uniqueness of BIMAP data When using Bimap, value uniqueness is required. If value is repeated, an error is thrown: java.lang.IllegalArgumentException, for example: @Test
Table
When we need data structures with Multiple indexes, we can only use this ugly Map
Output:
{A=A2, B=B2, C=1=B1, 2=B2, 3=1={A=A1, B=B1, C=C1}, 2={A=A2, B=B2, C=C2}, 3={A=A3, B=B3, C=={1=A1, 2=A2, 3=A3}, B={1=B1, 2=B2, 3=B3}, C={1=C1, 2=C2, 3=
Table View:RowMap () returns a Map Row (r) returns a non-null Map The column-related methods include columnMap (), columnKeySet (), and column (c ). (Column-based operations are less efficient than Row-based operations)The returned result of cellSet
1. Introduction
The Guava project contains a number of core libraries that are heavily reliant on Google's Java projects, including collections, caching, primitives support, concurrency libraries, common Annotations, string processing, I/O, and so on. These high quality APIs can make your Java code more elegant and concise, making your work easier and more enjoyable.
2. Official Information
Official home: Http://code.google.com/p/
In daily development, we sometimes need to construct a Map
Note: It is too difficult to implement
Multimap
The Multimap of Guava provides a data structure that conveniently maps a key to multiple values. This allows us to easily and elegantly implement the complex data structure above, so that we can focus on implementing business logic rather than on the data structure, next, let's take a look at the knowledge points of Multimap.
The above code
Guava
However, you can search for javadoc over the Internet.
This
Basic utilities (Basic tool set): Used
Using and avoiding null (avoid null): null
Preconditions (:
Common object methods (Common object method): simplifies the implementation of object methods, such as hashCode () and toString. (Note: In Native java, an object acts as a Map)
Ordering: (SORT): Guava
GuavaGuava is a utility repository for Google's Open source, which has been enhanced in many ways by the Java class Library. For example, support for functional programming , new collection Classes (Multimap, etc.),Cache support, and so on. Before Java8 , the relationship between guava and Java can be expressed as the following image:But with the release of Java8, there have been some changes in the relationship between
Source code of the takeout ordering website system, custom development and construction of the ordering website system, and the ordering source code
Imitation Meituan ordering website system, ELE. Me website ordering system source code development, professional support take
ExampleList scores;iterable Belowmedian =iterables.filter (Scores,range.lessthan (median)); .... Range validgrades = range.closed (1, N); for (int grade:ContiguousSet.create (validgrades, Discretedomain.integers ())) { ...}Brief introductionAn interval, sometimes referred to as a range, is a section of convexity in a particular domain (the informal term is continuous or uninterrupted). In form, convexity indicates to AThe interval can extend to infinity-for example, the range "X>3″" includes
Translated from Google Guava CacheThis Post was a continuation of my series on Google guava, this time covering guava Cache. Guava Cache offers more flexibility and power than either a HashMap or concurrenthashmap, but was not as heavy as using EHC Ache or Memcached (or robust for the matter, as
Tags: ALT monitor IMG LSE based on Not for Call () Builder projectGuava is an open source Java framework for Google, and its GitHub address is Https://github.com/google/guava. The Guava project contains several core libraries that are widely relied on by Google's Java projects, such as: collections [Collections], cache [caching], native type support [primitives supports], concurrent libraries [concurrency L
Google Guava Official tutorial (Chinese version)Link Translator: Shenyan, lolli tree, He Yixin, Vouzou proofreading : Fang FeiIntroductionThe Guava project contains several core libraries that are widely relied on by Google's Java projects, such as: collections [Collections], cache [caching], native type support [primitives supports], concurrent libraries [Concurrency Lib Raries], common annotations [common
This blog reference from: http://ifeve.com/google-guava-cachesexplained/
Guava's maven dependency:
Guava Cache Application Scenario:
It is quite useful to be slow in many scenarios. For example, the cost of calculating or retrieving a value is high, and you should consider using caching when you need to get a value more than once for the same input.
Guava cache
The following documents are organized from the network1. Introduction to Google guava
Introduction
The guava project contains several core libraries that are widely relied on by Google's Java projects. For example: set [collections], cache [caching], native support [primitives support], concurrent Library [concurrency libraries], General annotation [common annotations], string processing [string processing
Guava provides us with the event Bus Eventbus library in Guava-libraries, which is an implementation of the event release subscription model, allowing us to decouple the design of our modules and domain boundaries in domain-driven design (DDD) with the weak reference nature of events.No more nonsense, straight to the guava Eventbus theme. First
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.