Code Monkey home page Code Monkey logo

source-code-analysis's Introduction

Source-code-analysis

java源码分析

集合

Arrays

ArrayDeque

ArrayList

BitSet

CopyOnWriteArrayList

Collections

ConcurrentHashMap

EnumMap

HashMap

LinkedHashMap # afterNodeAccess中有一处有疑问,求大神解答

HashSet

Properties

PriorityQueue

TreeMap

TreeSet

LinkedList

Stack

StringBuilder

Vector

I/O

BufferedReader

File

InputStreamReader

RandomAccessFile

并发

CompletableFuture

AbstractQueuedSynchronizer

ArrayBlockingQueue

StampedLock

CountDownLatch

CyclicBarrier

Semaphore

ReentrantLock

ReentrantReadWriteLock

设计模式

  • 部分类使用了lombok注解,对对象进行简化,具体使用到的为@Data @AllArgsConstructor @NoArgsConstructor @Builder(toBuilder = true)可以自行查阅具体使用方法

Proxy

Singleton

Delegate

Strategy

Template

Prototype

Factory

Builder

Adapter

Bridge

Decorator

Facade

Composite

FlyWeight

Memento

Observer

Chain

Command

Spring源码分析

spring ioc

FileSystemXmlApplicationContext

AbstractApplicationContext

BeanFactory

BeanDefinition

Resource

AnnotationUtils

source-code-analysis's People

Contributors

hawk97 avatar jqs1970291214 avatar stalary avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

source-code-analysis's Issues

设计模式-静态代理-User类

// 使用对象
@DaTa
@AllArgsConstructor
public class User {

private Integer id;

private String username;

}

这里是不是缺了个带参的构造方法。Main中是这样的:
// 测试类
public class Main {

public static void main(String[] args) {
    ZooProxy proxy = new ZooProxy(new ZooImpl());
    proxy.enter(new User(1, "stalary"));
    proxy.enter(new User(2, "hawk"));
    proxy.enter(new User(3, "claire"));
}

}
另外还有get/set以及toString()方法,否则与测试结果不符。

ArrayList源码分析

//构造一个包含特定元素的list,用iterator依次取出collection中的元素
public ArrayList(Collection<? extends E> c) {
elementData = c.toArray();
if ((size = elementData.length) != 0) {
//这里有个bug,c.toArray()可能不会返回Object[]
//这里为什么会不返回Object[]数组,能给解释一下么? 您指的bug是什么呢?
if (elementData.getClass() != Object[].class)
elementData = Arrays.copyOf(elementData, size, Object[].class);
} else {
// replace with empty array.
this.elementData = EMPTY_ELEMENTDATA;
}
}

提个建议

  • 设计模式的例子有的感觉不太恰当,比如策略模式的例子。同时,在介绍各个模式的时候,缺乏一些经验性的总结,比如什么情况下建议使用、好处是什么、坏处是什么,最好可以再加上一点很有代表性的例子,比如 spring 中是怎么使用这种设计模式的。

  • spring 源码的解读,个人建议不要从 AppLicationContext 开始往下看,这样容易摸不着头脑。你会对一些步骤感到很奇怪。我觉得在解读源码之前,最好先理清 spring 都做了哪些事;为什么要做;如果是你,你会怎么做;spring 是怎么做的;为什么要这样做。。从下往上看,思路会更清晰一些。通俗一点就是,从 BeanFactory、Resource、ResourceLoader、BeanDefination 这部分开始看起。先看加载过程,然后看初始化过程,最后看整体设计。当然,从上往下看也没问题,但是感觉不是很好,个人建议。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.