杂项
文章平均质量分 63
liujunzxcv
这个作者很懒,什么都没留下…
展开
-
使用jackson将Map转成Json字符串
这里主要是用com.fasterxml.jackson.databind.ObjectMapper 类里面的 @SuppressWarnings("resource") public String writeValueAsString(Object value) throws JsonProcessingException例如: Map<String,...原创 2018-03-06 20:39:30 · 26616 阅读 · 0 评论 -
Thinking in Java接口与抽象类
//: interfaces/Adventure.java// Multiple interfaces.interface CanFight { void fight();}interface CanSwim { void swim();}interface CanFly { void fly();}class ActionCharacter { publi...原创 2018-03-15 00:16:49 · 114 阅读 · 0 评论 -
HashMap源码阅读
// 将“key-value”添加到HashMap中 public V put(K key, V value) { // 若“key为null”,则将该键值对添加到table[0]中。 if (key == null) return putForNullKey(value); // 若“key不为null”,则计算该k...原创 2018-03-10 22:37:00 · 89 阅读 · 0 评论 -
LinkedHashMap对于LRU的实现
首先LinkedHashMap就是继承了HashMap,在此基础上维护一个双向链表,实现也很简单,就是对Entry进行改造:/** * LinkedHashMap entry. */ private static class Entry<K,V> extends HashMap.Entry<K,V> { // These ...原创 2018-03-17 16:51:10 · 176 阅读 · 0 评论