摘要:
// 创建Map其中newHashMapWithExpectedSize更具有实际意义 Map<Integer, Integer> map1= Maps.newHashMap(); Map<Integer, Integer> map2 = Maps.newHashMapWithExpectedSiz 阅读全文
posted @ 2021-05-29 23:19
程序员008
阅读(45)
评论(0)
推荐(0)
摘要:
单列集合的工具类 // Lists // 创建集合 List<String> list1 = Lists.newArrayList(); List<String> list2 = Lists.newArrayListWithCapacity(8); List<String> list3 = List 阅读全文
posted @ 2021-05-29 23:12
程序员008
阅读(63)
评论(0)
推荐(0)
摘要:
双列集合的方法被标注了@Beat表示不稳定 使用方法 1.通过on方法设置分割符号 2.使用omitEmptyStrings方法可以去掉空元素 3.使用trimResults方法删除元素前后空白字符 4.使用split/splitToList/splitToStream指定将字符串切分成迭代器/集合 阅读全文
posted @ 2021-05-29 22:39
程序员008
阅读(195)
评论(0)
推荐(0)
摘要:
单列集合的拼接 List<String> colors = Lists.newArrayList("red", "blue", null, "purple", "yellow", "pink", null); try { // 不过滤null,如果有null那么会抛NPE String colorS 阅读全文
posted @ 2021-05-29 21:19
程序员008
阅读(152)
评论(0)
推荐(0)
摘要:
使用步骤 1.定义匹配字符的匹配器2.处理匹配的字符序列 创建 CharMacher // 匹配所有的 CharMatcher charMatcher1 = CharMatcher.any(); CharMatcher charMatcher2 = CharMatcher.anyOf("aef"); 阅读全文
posted @ 2021-05-29 20:56
程序员008
阅读(302)
评论(0)
推荐(0)
摘要:
比较器例子 import com.google.common.collect.ComparisonChain; import com.google.common.collect.Ordering; import java.util.Arrays; import java.util.Comparato 阅读全文
posted @ 2021-05-29 18:54
程序员008
阅读(60)
评论(0)
推荐(0)
摘要:
JDK1.8之前Objects还是挺方便的,但是1.8之后JDK自带的Objects功能更加完善 import com.google.common.base.MoreObjects; import lombok.Data; import java.util.Objects; @Data public 阅读全文
posted @ 2021-05-29 13:52
程序员008
阅读(177)
评论(0)
推荐(0)
摘要:
Guava是Google公司内部Java开发工具库的开源版本。它提供了一些JDK没有提供的功能,以及对JDK已有功能的增强功能。其中就包括:集合(Collections)、缓存(Caching)、原生类型支持(Primitives Support)、并发库(Concurrency Libraries 阅读全文
posted @ 2021-05-29 11:55
程序员008
阅读(386)
评论(0)
推荐(0)

浙公网安备 33010602011771号