
Android源码
Android源码
It一zhai男
Android,kotlin,Java,flutter,python,
展开
-
【Dagger2】一文让你从Dagger2入门到熟练
@Inject注解在属性中表示该属性需要依赖注入,注解的属性不能使用private修饰,只能用默认、protected或public注解在方法中表示该方法需要依赖注入,注解的方法不能是抽象方法,不能是private修饰的注解在构造方法中表示此类能为Dagger2提供依赖关系,如果有多个构造函数,只能注解一个,否则会报错...原创 2020-04-26 19:34:49 · 376 阅读 · 0 评论 -
【LinkedList源码】LinkedList的构造方法源码及用法
1 LinkedList构造方法LinkedList继承自AbstractSequentialList类,实现了List、Deque、Cloneable和Serializable接口。linkedList有两个构造方法,一个是无参构造方法,一个是有一个参数的构造方法。构造方法源码如下所示:/** * Constructs an empty list. */ publ...原创 2019-07-27 23:43:50 · 1228 阅读 · 0 评论 -
【ArrayList源码】remove源码及使用
1 remove源码在ArrayList源码里,remove有两个方法,一个是按照索引index移除元素,另一个是按照值移除元素。 /** * Removes the element at the specified position in this list. * Shifts any subsequent elements to the left (subtract...原创 2019-07-26 22:17:46 · 1426 阅读 · 0 评论 -
【ArrayList源码】get源码及使用
1 get源码 /** * Returns the element at the specified position in this list. *返回列表中指定位置的元素 * @param index index of the element to return * @return the element at the specified pos...原创 2019-07-22 20:18:04 · 619 阅读 · 0 评论 -
【ArrayList源码】lastIndexOf源码及使用
1 lastIndexOf源码 /** * Returns the index of the last occurrence of the specified element * in this list, or -1 if this list does not contain the element. * More formally, returns the...原创 2019-07-21 23:43:16 · 370 阅读 · 0 评论 -
【ArrayList源码】contains源码及使用
1 contains源码 /** * Returns <tt>true</tt> if this list contains the specified element. * More formally, returns <tt>true</tt> if and only if this list contains ...原创 2019-07-20 23:17:45 · 732 阅读 · 0 评论 -
【Thread源码】join源码及使用
1 join源码/** * Waits for this thread to die. *等待当前线程死亡(指的是主线程等待当前线程死亡) * <p> An invocation of this method behaves in exactly the same * way as the invocation * * &l...原创 2019-07-18 21:13:47 · 208 阅读 · 0 评论 -
【ArrayList源码】add方法(自动扩容)
1 add源码解析在【ArrayList源码】ArrayList构造方法中,ArrayList无参构造方法默认是一个空数组,但注释说是容量为10的数组。其实ArrayList的容量是在调用add方法时初始化的。add方法是List接口中声明的通用方法。ArrayList的add源码如下所示:/** * Appends the specified element to the end ...原创 2019-07-16 11:52:50 · 1823 阅读 · 1 评论 -
【Java源码】String中的equals方法
本文基于JDK1.81 String中equals源码分析String是final类型,它不可被继承。String的equals方法如下所示: /** * Compares this string to the specified object. The result is {@code * true} if and only if the argument is...原创 2019-07-14 22:26:29 · 704 阅读 · 0 评论 -
【ArrayList源码】indexOf源码及使用
1 ArrayList的indexOf方法ArrayList的indexOf源码如下:/** * Returns the index of the first occurrence of the specified element * in this list, or -1 if this list does not contain the element. * ...原创 2019-07-13 23:45:36 · 1735 阅读 · 0 评论 -
【Android源码】setContentView源码分析(一)
1 Activity中的setContentView我们都知道Activity里,setContentView是我们用来加载布局的,那么它里面的源码是怎么样的呢?先看下父类Activity里面的setContentView方法体 /** * Set the activity content from a layout resource. The resource will b...原创 2019-07-15 15:40:03 · 536 阅读 · 0 评论 -
【ArrayList源码】ArrayList构造方法
文章目录ArrayList简介1 无参构造方法2 一个参数的构造方法,参数为初始的容量3 参数为集合的构造方法ArrayList简介ArrayList称为数组链表,它是继承AbstractList,并实现了List、RandomAccess、Cloneable和Serializable接口public class ArrayList<E> extends AbstractList...原创 2019-07-12 15:18:48 · 3459 阅读 · 0 评论 -
【Java】List源码一
List是一个接口,继承自Collection,数据类型是泛型。public interface List<E> extends Collection<E>{}size()返回的是int类型,返回的数据表示链表的长度,如果链表中数据的长度超过Integer.MAX_VALUE,那么返回的数值为Integer.MAX_VALUE。int size();...原创 2019-07-11 21:27:55 · 230 阅读 · 0 评论 -
【Android】okHttp源码之RetryAndFollowUpInterceptor
RetryAndFollowUpInterceptorRetryAndFollowUpInterceptor是用于失败重试及重定向的拦截器。在okHttp中,无论是调用同步execute方法或者是异步enqueue方法最终都会调用响应拦截链方法——getResponseWithInterceptorChain()。该方法主要是建立各种拦截器,RetryAndFollowUpInterceptor...原创 2019-07-08 22:51:20 · 275 阅读 · 0 评论