Skip to content

Commit a81a74f

Browse files
committed
🎨 改进代码的结构/格式
1 parent ebea5f1 commit a81a74f

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/main/java/com/crossoverjie/actual/LRUMap.java

+2-6
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,10 @@ private void addNode(K key, V value) {
131131
if (cacheSize == nodeCount) {
132132
//删除尾结点
133133
delTail();
134-
135-
//写入头结点
136-
addHead(node);
137-
} else {
138-
addHead(node);
139-
140134
}
141135

136+
//写入头结点
137+
addHead(node);
142138

143139
}
144140

src/test/java/com/crossoverjie/actual/LRUMapTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public void get() throws Exception {
5656
}
5757

5858
@Test
59-
public void get3() throws Exception {
59+
public void get2() throws Exception {
6060
LRUMap<String,Integer> lruMap = new LRUMap(3) ;
6161
lruMap.put("1",1) ;
6262
lruMap.put("2",2) ;
@@ -72,7 +72,7 @@ public void get3() throws Exception {
7272
}
7373

7474
@Test
75-
public void get4() throws Exception {
75+
public void get3() throws Exception {
7676
LRUMap<String,Integer> lruMap = new LRUMap(3) ;
7777
lruMap.put("1",1) ;
7878
lruMap.put("2",2) ;

0 commit comments

Comments
 (0)