摘要:
概述Enums提供了几个操作Enum的便利方法常用方法Field getField(Enum enumValue):返回变量名为enumValue变量值的Field> Function valueOfFunction(Class enumClass): 返回一个可以将enum名字字符串转换成指定类型的enum的,如果enum不存在时,Function将返回nullOptional getIfPresent(Class enumClass, String value):使用Enum.valueOf()来返回指定名称和class的Enum的Optional,如果不存在则返回Absent, 常 阅读全文
摘要:
概述CharMatcher提供了多种对字符串处理的方法, 它的主要意图有:1. 找到匹配的字符2. 处理匹配的字符CharMatcher内部主要实现包括两部分:1. 实现了大量公用内部类, 用来方便用户对字符串做匹配: 例如 JAVA_DIGIT 匹配数字, JAVA_LETTER 匹配字母等等.2. 实现了大量处理字符串的方法, 使用特定的CharMatcher可以对匹配到的字符串做出多种处理, 例如 remove(), replace(), trim(), retain()等等CharMatcher本身是一个抽象类, 其中一些操作方法是抽象方法, 他主要依靠内部继承CharMatcher的 阅读全文
摘要:
概述CaseFormat用来转换各种不同的编程语言间的变量名命名格式, 主要用到的方法只有一个 CaseFormat.to(CaseFormat from, String s) CaseFormat fromFormat = CaseFormat.LOWER_CAMEL; CaseFormat toFormat = CaseFormat.UPPER_CAMEL; String s = "lowerCamel"; System.out.println(fromFormat.to(toFormat, s));输出lowerCamelLower... 阅读全文
摘要:
本文主要介绍HotSpot JVM的 Generations 机制,原文来自 Oracle 文档 Java SE 6 HotSpot[tm] Virtual Machine Garbage Collection Tuning 第三,四章 -- Generations & Performance Co... 阅读全文
摘要:
前言本文主要介绍JVM的运行时数据区来自Oracle文档Java Virtual Machine Specification--Chapter2.The Structure of the Java Virtual Machine 2.5Link :http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-2.html#jvms-2.5---------------------------------------------------------------------------------------------------------- 阅读全文
摘要:
The original link :http://zeroturnaround.com/rebellabs/rjc201/From ClassLoaders to Classes从ClassLoader到ClassesIf you have programmed in Java for some time you know that memory leaks do happen. Usually it’s the case of a collection somewhere with references to objects (e.g. listeners) that should hav 阅读全文
摘要:
BiMapBiMap是一个结构,他定义了一个Map结构,代表这个Map的key和value都具有唯一性, 并且可以生成相互联系的反向视图, 反向视图的数据会随着本体BiMap的变更而变更/* * Copyright (C) 2007 The Guava Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a c 阅读全文
摘要:
The original link:http://zeroturnaround.com/rebellabs/reloading-objects-classes-classloaders/A Bird's Eye View鸟瞰The first thing to understand when talking about reloading Java code is the relation between classes and objects. All Java code is associated with methods contained in classes. Simplif 阅读全文
摘要:
概述CompoundOrdering是Ordering的子类,它用来存储比较器链, Ordering的compound()内部实现就是使用CompoundOrdering(Comparator primary, Comparator secondary)方法来实现的代码/** An ordering that tries several comparators in order. */@GwtCompatible(serializable = true)final class CompoundOrdering extends Ordering imple... 阅读全文
摘要:
TODO: rewrite with more examplesGuava'sThrowablesutility can frequently simplify dealing with exceptions.Propagation 传播Sometimes, when you catch an exception, you want to throw it back up to the next try/catch block. This is frequently the case forRuntimeExceptionorErrorinstances, which do not r 阅读全文