Reprint: https://my.oschina.net/realfighter/blog/349821The object class in Java is a superclass of all Java classes (that is, ancestors), all objects implement methods in the object class, and in daily work, we often need to rewrite several of them, such as equals, toString, hashcode, and so on, while at work , we implement these methods are sometimes more painful, such as the Equals method to judge non-null, the ToString debugging information is incomplete, etc., in
In the previous article "Multimap of Guava learning", we talked about Multimap In the Guava class library, which features that key-value pairs in Multimap can be unique. We know that, there is a Map in the Java Collection class library, which features that the stored Key is unique, and the Value can be unique. If we need a Key) each Value is unique. How can this problem be solved? This is the BiMap structur
In RangeSet of Guava learning, we talked about the features and usage of RangeSet. There are many differences between RangeMap and RangeSet.On the official API of Google Guava, we can know that RangeMap is a collection type that does not intersection and is not an empty Range (key) map to a Value ). Unlike RangeSet, RangeMap cannot merge adjacent intervals even if the ing value is the same.Like RangeSet, Ra
It is believed that many people began to use the JDK Library to operate the file, the tedious duplication of code is disgusting, of course, this is the reason for the various libraries. The next introduction to the files class of guava provides a great simplification of file operations, such as the ability of a programmer to switch off a stream without worrying about it at all.This paper describes the basic operation of files such as copying, renaming
Guava Chinese is the meaning of pomegranate, this project is an open source project of Google, contains many Google Core Java Common library.
Currently mainly includes:
Com.google.common.annotations
Com.google.common.base
Com.google.common.collect
Com.google.common.io
Com.google.common.net
Com.google.common.primitives
Com.google.common.util.concurrentOnline API Doc:http://tool.oschina.net/apidocs/apidoc?api=
Guava Preconditions tool parameter pre-check, guavapreconditions
Preconditions is a tool class provided by guava for code verification. It provides many important static verification methods.
It is used to simplify code verification or preprocessing in our work or development. It verifies the rationality before the logic starts to avoid data errors caused by too deep parameter input.
In addition, we can acc
Google guava basic tools and googleguava tools
Recently, I used the google cache in the project to learn about some tool classes in guava and the operations on the set. The packages are compared and I don't have time to write them myself. I will mark them first,
The reference document is as follows:
Http://macrochen.iteye.com/blog/737058
Http://my.oschina.net/indestiny/blog/214668
What is Google
Using the Guava Sorting tool class, the high-speed implementation of the object's single-variable ordering and multivariable sequencing, so that your development efficiency exploded ...Import Com.google.common.collect.lists;import Com.google.common.collect.ordering;import Com.google.common.primitives.ints;import Java.util.collections;import Java.util.comparator;import Java.util.iterator;import Java.util.list;public class Citybypopluation implements co
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
Guava eventbus code analysis (1), guavaeventbus
Before analyzing guava eventbus, let's take a look at the traditional observer mode:
The Subject interface is an abstract topic, which is equivalent to an observer. It holds a list of listener observers. The attach method registers the listener in this list, and the detach method deregisters the listener, Y method is used to notify the listener in the list wh
. DelayQueue is actually an encapsulation of a priority queue. Early tasks have a higher priority. It is mainly used to run tasks after a given delay, or regularly execute tasks. ScheduledThreadPoolExecutor features similar to Timer, but ScheduledThreadPoolExecutor is more flexible than Timer, and multiple background threads can be specified in the constructor.
Future interface and ListenableFurture Interface
The Future interface provides a stub (stub) for the asynchronous computing result re
Google's Guava is an artifact added to the JDK, and deserves to be studied well.Access restrictions for general web systems can be implemented using the container itself, such as Tomcat, which can be configured with a limit of connection number on the connector, and the servlet thread limit.Sometimes the system is complicated and wants to provide different ratelimiter for different services, such as the higher rate of database operation, the rate at w
Ordering I read many times in Chinese documents, add some examples finally figure out what's going on.What's he doing? Just like his name, used to ordering sort. 、There are two main ways of doing this.1 is sorted by its static method. such as Ordering.natural (); make a natural sort of sortable type, such as number by size, date by order. Natual () The official interpretation of the translation. 2 Ordering defined by oneselfFor example, you want to sort by the length of the string. Public voi
Object.hashcode (). In short, the Bloom filter is a probabilistic data structure that allows you to detect whether an object is definitely not in the filter, or it may have been added to the filter. This is a comprehensive introduction to the Bloom Filter Wiki page, and we recommend a tutorial on GitHub.The Guava Hash pack has an built-in bloom filter implementation that you can use as long as you provide funnel. You can get bloomfilterBloomfilterHas
Today, we will talk about the multi-dataset data structure in the guava class library. Although it is not often used, it is necessary to discuss it. We know that the set in the Java class library cannot store the same elements, and the elements in the class are unordered. The list can store the same elements in sequence. The current multi-dataset can store the same elements, but the order between elements is unordered. We can also see from this that m
Package com.google.common.base;Guava source of the method of this class introduction only one sentence:Utility methods for working with {@link Enum} instances.This means the tool method that is provided to the enum instance.What is an enumeration?Enumerations are simply a type of data, except that the data type contains only custom specific data, which is a set of data that has a common attribute.For example, a color can also be defined as an enumerat
Guava is Google's Java class Library, the function is very powerful, the following is the local memory Cache tool class instance, the first time by calling get (key), will call load to get the value, when called again, we find that it is called directly from the cache, according to MaximumSize set the cache size, When the size exceeds the limit, the furthest data is removed from the cache. Examples are as follows.Guava Cahche instance, through Loading
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.