Skip to content

Commit e29145c

Browse files
committed
JAVA 知识体系
1 parent d26e779 commit e29145c

4 files changed

Lines changed: 41 additions & 10 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
- 动态代理与cglib实现的区别。
2121
- 为什么CGlib方式可以对接口实现代理。
2222
- final的用途。
23-
- 写出三种单例模式实现 。
23+
- [写出三种单例模式实现](http://tech.hunts.work/2015/09/01/%E7%B3%BB%E7%BB%9F%E6%9E%B6%E6%9E%84/%E7%B3%BB%E7%BB%9F%E6%9E%B6%E6%9E%84-%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/#1-%E5%8D%95%E4%BE%8Bsingleton)
2424
- 如何在父类中为子类自动完成所有的hashcode和equals实现?这么做有何优劣。
2525
- 请结合OO设计理念,谈谈访问修饰符public、private、protected、default在应用设计中的作用。
2626
- 深拷贝和浅拷贝区别。
@@ -161,7 +161,7 @@
161161
- 一个在线文档系统,文档可以被编辑,如何防止多人同时对同
162162
- 一份文档进行编辑更新。
163163
- 线上系统突然变得异常缓慢,你如何查找问题。
164-
- 说说你平时用到的设计模式。
164+
- [说说你平时用到的设计模式](http://tech.hunts.work/2015/09/01/%E7%B3%BB%E7%BB%9F%E6%9E%B6%E6%9E%84/%E7%B3%BB%E7%BB%9F%E6%9E%B6%E6%9E%84-%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/#2-%E7%AE%80%E5%8D%95%E5%B7%A5%E5%8E%82simple-factory)
165165
- Dubbo的原理,有看过源码么,数据怎么流转的,怎么实现集群,负载均衡,服务注册
166166
- 和发现,重试转发,快速失败的策略是怎样的 。
167167
- 一次RPC请求的流程是什么。

src/main/java/com/algorithm/study/demo/LRUCache/LRUMap.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ public static void main(String[] args) {
166166
lruMap.get("1");
167167
lruMap.put("4","4");
168168
System.out.println(lruMap.toString());
169+
System.out.println(lruMap.cacheSize);
169170
}
170171

171172
}

src/main/java/com/algorithm/study/demo/datastructure/linear/MLinkList.java

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.algorithm.study.demo.datastructure.linear;
22

3+
import java.util.Stack;
4+
35
/**
46
* 线性表的链式存储-单链表的实现
57
* 单链表采用链式存储结构,用一组任意的存储单元存放线性表元素
@@ -177,11 +179,38 @@ public void clear(){
177179
size=0;
178180
}
179181
private void checkPositionIndex(int index) {
180-
if (index<0 || index>size-1)
182+
if (index<0 || index>size-1){
181183
throw new IndexOutOfBoundsException("数组越界Index: "+index+", Size: "+size);
184+
}
182185
}
183186
public int size(){
184187
return size;
185188
}
186189

190+
191+
@Override
192+
public String toString(){
193+
StringBuilder sb=new StringBuilder();
194+
int j=1;
195+
Node temp=data;
196+
while (j<size){
197+
sb.append(data.data);
198+
temp= data.next;//找到最后一个结点
199+
j++;
200+
}
201+
return sb.toString();
202+
}
203+
public static void main(String[] args) {
204+
MLinkList mLinkList=new MLinkList();
205+
mLinkList.add("a");
206+
mLinkList.add("b");
207+
mLinkList.add("c");
208+
mLinkList.add("b");
209+
mLinkList.add("a");
210+
System.out.println(mLinkList.toString());
211+
System.out.println(mLinkList.size);
212+
System.out.println(mLinkList.toString());
213+
214+
}
215+
187216
}

src/main/java/com/algorithm/study/demo/datastructure/linear/TwoLinkList.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
package com.algorithm.study.demo.datastructure.linear;
22

3-
import com.algorithm.study.demo.LRUCache.LRUMap;
4-
53
/**
64
* 双向链表实现
75
* Created by liuxun on 2017/6/19.
86
*/
9-
public class TwoLinkList<E> {
7+
public class TwoLinkList<E>{
8+
109

1110
private class Node<E> {
1211
private Node prev;//上一节点
@@ -141,8 +140,9 @@ public Object getLast(){
141140
return last.element;
142141
}
143142
private void checkPositionIndex(int index) {
144-
if (index<0 || index>size-1)
143+
if (index<0 || index>size-1){
145144
throw new IndexOutOfBoundsException("数组越界Index: "+index+", Size: "+size);
145+
}
146146
}
147147
public int size(){
148148
return size;
@@ -159,9 +159,10 @@ public String toString() {
159159
return sb.toString();
160160
}
161161
public static void main(String[] args) {
162-
TwoLinkList<String> twoLinkList=new TwoLinkList<>();
163-
// twoLinkList.add("1");
164-
// twoLinkList.add("2");
162+
TwoLinkList<String> twoLinkList=new TwoLinkList<String>();
163+
twoLinkList.add("1");
164+
twoLinkList.add("2");
165+
twoLinkList.add("3");
165166
System.out.println(twoLinkList.toString());
166167
}
167168
}

0 commit comments

Comments
 (0)