Java 快速生成 Map

方式1:匿名内部类123456789101112131415161718import org.junit.Test;import java.util.HashMap;import java.util.Map;public class MapUtilT...

Java 快速生成 List

方式1:使用 Arrays.asList示例1: 123456789101112131415import org.junit.Test;import java.util.Arrays;import java.util.List;public clas...

Hello World

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, yo...

Java 字符串左侧 右侧补充空格或者其他字符

方式1:自定义方法12345678910111213141516171819202122232425262728public class StringPad { public static void main(String[] arg...

kafka SnappyError no native library is found 问题

使用 kafka 时报错: 1org.xerial.snappy.SnappyError: [FAILED_TO_LOAD_NATIVE_LIBRARY] no native library is found for os.name=Mac and ...

使用 Guava RateLimiter 限速

RateLimiter 是基于令牌桶实现的限速。 引入依赖如果是使用 gradle 管理 Java 依赖,在 dependencies 中配置: 1compile "com.google.guava:guava:$latestVersion...

Java 多行字符串

方式112345String s = "床前明月光,\n" + "疑是地上霜。\n" + "举头望明月,\n" + "低头思故乡。&quo...

Java 生成 CSV 文件

示例112345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656...