guava这个工具包里有好多有用的工具类

<dependency>
  <groupId>com.google.guava</groupId>
  <artifactId>guava</artifactId>
  <version>${guava.version}</version>
</dependency>
com.google.common.base.Objects.firstNonNull(jimDB.get(lockKey), "0")  返回第一个非空元素,如果第一个非空,就返回第一个元素,否则就继续判断第二个元素,第二个不为空,就返回第二个,第二个也为空,就抛出异常
Map<String, String> result = com.google.common.collect.Maps.newHashMap();
 
Set<StringRedisTemplate> canExpireRedisTemplateSet = com.google.common.collect.Sets.newHashSet()
 

//定时缓存

private com.google.common.cache.LoadingCache<String, AtomicInteger> failedCache =
com.google.common.cache.CacheBuilder.newBuilder()
.softValues()
.maximumSize(10000)
.build(new com.google.common.cache.CacheLoader<String, AtomicInteger>() {
@Override
public AtomicInteger load(String skuId) throws Exception {
return new AtomicInteger(0);
}
});

com.google.common.util.concurrent.RateLimiter   rateLimiter =  com.google.common.util.concurrent.RateLimiter.create(rate);

com.google.common.base.Splitter  COMMA_SPLITTER = com.google.common.base.Splitter.on(“;”).trimResults().omitEmptyStrings();

 
com.google.common.base.Strings.isNullOrEmpty(referer)   //判断是否为空
 
 

google guava工具包的更多相关文章

  1. 有关google的guava工具包详细说明

    Guava 中文是石榴的意思,该项目是 Google 的一个开源项目,包含许多 Google 核心的 Java 常用库. 目前主要包含: com.google.common.annotations c ...

  2. 【转载】使用 Google Guava 美化你的 Java 代码

    转载地址: https://blog.csdn.net/wisgood/article/details/13297535 原文地址:https://my.oschina.net/leejun2005/ ...

  3. Google Guava 类库简介

    Guava 是一个 Google开发的 基于java的类库集合的扩展项目,包括 collections, caching, primitives support, concurrency librar ...

  4. java开发人员,最应该学习和熟练使用的工具类。google guava.(谷歌 瓜娃)

    学习参考文章: http://blog.csdn.net/wisgood/article/details/13297535 http://ifeve.com/google-guava/ http:// ...

  5. [转]Google Guava官方教程(中文版)

    Google Guava官方教程(中文版) http://ifeve.com/google-guava/

  6. Google Guava官方教程(中文版)

    Google Guava官方教程(中文版) 原文链接  译文链接 译者: 沈义扬,罗立树,何一昕,武祖  校对:方腾飞 引言 Guava工程包含了若干被Google的 Java项目广泛依赖 的核心库, ...

  7. Google Guava vs Apache Commons for Argument Validation

    It is an established good practice to validate method arguments at the beginning of the method body. ...

  8. 使用 Google Guava 美化你的 Java 代码

    文章转载自:http://my.oschina.net/leejun2005/blog/172328 目录:[ - ] 1-使用 GOOGLE COLLECTIONS,GUAVA,STATIC IMP ...

  9. Google Guava之--cache

    一.简介 Google Guava包含了Google的Java项目许多依赖的库,如:集合 [collections] .缓存 [caching] .原生类型支持 [primitives support ...

随机推荐

  1. Win10+GPU版Pytorch1.1安装

    环境配置篇 安装cuda 更新nvidia驱动 打开GeForce Game Ready Driver或在 GeForce Experience中下载符合自己gpu的程序. 选择cuda 打开nvid ...

  2. maven的基本使用

    安装: 1.下载maven http://maven.apache.org/ 2.将maven包解压并放置到安装目录 3.添加环境变量M2_HOME,path当中添加;%M2_HOME%\bin; 4 ...

  3. split 使用

    split作用:把字符串变成列表,这个字符串必须是多行文字.如果是单行文字或一个单词是不行的,实例操作如下: In [46]: output=subprocess.check_output(['df' ...

  4. linux常用、常见错误

    1.md5加密使用 oppnssl md5 加密字符串的方法 [root@lab3 ~]# openssl //在终端中输入openssl后回车. OpenSSL> md5 //输入md5后回车 ...

  5. jQuery选择:子代元素与后代元素的区别

    (1)后代元素:html代码如下,那么在jquery选择时,$(".test img"),中间为空格,则是选取后代元素,img对于ul来说是孙子辈元素,中间隔了li元素,所以后代元 ...

  6. jmeter设置全局变量与正则表达式提取器

    接口测试中,很多接口都要带上登录后的token才能正常发送请求,这里记录一下登录获取token设置为全局变量供其他接口使用 登录后返回信息信息中会有一个token值,添加后置处理器中的正则表达式提取t ...

  7. Typora快捷键记录

    目前使用的是Typora这款Markdown软件,记录一下快捷键用法: 1.无序列表,黑色实心圆点或白色空心圆点 首先去除缩进,使用“Ctrl”+"["键或者“Shift”+&qu ...

  8. 白盒测试笔记之:Junit 单元测试以及测试覆盖率

    单元测试: 单元测试是从代码层面验证代码的正确性. 一般考虑接口中的数据结构是否正确,变量的临界条件,如空字符串,空集合等. ​ Junit入门  参考: Junit 入门教程: https://ww ...

  9. __str__,__repr__,__add__

    class School: def __init__(self,name,addr,type): self.name=name self.addr=addr self.type=type def __ ...

  10. 判断给定的整数n能否表示成连续的m(m>1)个正整数之和

    #include<stdio.h> int main(){ //如果是奇数,肯定满足条件 int num; scanf("%d",&num); ==){ pri ...