
Java源码解释
qq_43079667
这个作者很懒,什么都没留下…
展开
-
ModelAndView的构造函数
构造函数1:无参构造函数 public ModelAndView() {}构造函数2:初始化成员变量Object viewpublic ModelAndView(String viewName) { this.view = viewName; }构造函数3:初始化成员变量Object view 和 ModelMap modelpublic ModelAndView(String viewName, @Nullable Map<String, ?> model原创 2021-06-30 16:04:01 · 216 阅读 · 0 评论 -
HashMap中putVal认识
该方法的第一道流程:final V putVal(int hash, K key, V value, boolean onlyIfAbsent, boolean evict) { Node<K,V>[] tab; Node<K,V> p; int n, i; if ((tab = table) == null || (n = tab.length) == 0) n = (tab = res原创 2021-06-30 12:16:23 · 141 阅读 · 0 评论 -
ModelAndView构造函数
//无参构造函数 public ModelAndView() { } //实例化成员变量Object view public ModelAndView(String viewName) { this.view = viewName; } //实例化成员变量Object view public ModelAndView(View view) { this.view = view; } //...原创 2021-06-30 08:51:52 · 141 阅读 · 0 评论 -
JSONArray的构造方法
构造方法1:public JSONArray() { this.list = new ArrayList(); }构造方法2:public JSONArray(List<Object> list) { if (list == null) { throw new IllegalArgumentException("list is null."); } else { this.list =原创 2021-06-13 13:35:55 · 589 阅读 · 0 评论 -
JSONObject构造方法
构造方法1:服务于其他构造方法的构造方法public JSONObject(int initialCapacity, boolean ordered) { if (ordered) { this.map = new LinkedHashMap(initialCapacity); } else { this.map = new HashMap(initialCapacity); } }...原创 2021-06-13 11:29:16 · 820 阅读 · 0 评论 -
ArrayList<E>的构造方法:
构造方法1:public ArrayList(int initialCapacity) { if (initialCapacity > 0) { this.elementData = new Object[initialCapacity]; } else if (initialCapacity == 0) { this.elementData = EMPTY_ELEMENTDATA; } else {原创 2021-06-12 16:32:49 · 129 阅读 · 0 评论 -
String构造方法认识
构造方法1:根据一个String实例化一个String public String(String original) { this.value = original.value; this.hash = original.hash; }构造方法2:根据字符数据实例化一个Stringpublic String(char value[]) { this.value = Arrays.copyOf(value, value.length);原创 2021-06-10 13:55:13 · 172 阅读 · 0 评论 -
treemap的fixAfterInsertion认识
treemap中内部类Entry<K,V>了解:http://note.youdao.com/noteshare?id=d2a3b9c1276ecd5d6c5631da604443f8&sub=7AB2B31709D74F5593314079871FF8E7该方法作用:是对Entry<K,V>实例对象的成员变量color的操作用到了treemap的一些成员变量:treemap的成员变量:http://note.youdao.com/noteshare?id=3d527原创 2021-06-08 13:39:37 · 189 阅读 · 0 评论 -
treemap的rotateRight(Entry<K,V> p)
右旋的本质:将形参节点的左节点的右节点 作为 形参的左节点后引起的一系列操作----即需要考虑的问题如下:其他了解: 一个节点代表一个Entry<K,V>实例对象 一个节点的三根线连接的值分别代表 一个Entry对象中的 三个成员变量值:Entry<K,V> left Entry<K,V> right Entry<K,V> parent...原创 2021-06-08 13:18:31 · 107 阅读 · 0 评论 -
treemap的 rotateLeft(Entry<K,V> p)
第一道流程:private void rotateLeft(Entry<K,V> p) { if (p != null) { Entry<K,V> r = p.right; p.right = r.left; //现在改变的是对象的成员变量的值,而并不是改变对象的值-------成员变量也是对象 if (r.left != null) r.left.parent = p;原创 2021-06-08 10:55:05 · 168 阅读 · 0 评论 -
treemap中的put(K key, V value)
treeMap的成员变量:private final Comparator<? super K> comparator; **起什么作用**:key的比较器 **什么时候被初始化**:new treeMap对象时通 过构造方法初始化的private transient Entry<K,V> root; 是什么:是treemap对应的红黑树的根节点private transie原创 2021-06-08 07:56:54 · 288 阅读 · 0 评论 -
treeMap的构造方法
构造方法1:public TreeMap() { comparator = null; }构造方法2:public TreeMap(Comparator<? super K> comparator) { this.comparator = comparator; }构造方法3:public TreeMap(Map<? extends K, ? extends V> m) { comparator = nul原创 2021-06-07 15:34:46 · 361 阅读 · 0 评论 -
HashMap中的resize()认识
该方法的第一道流程:final Node<K,V>[] resize() { Node<K,V>[] oldTab = table; int oldCap = (oldTab == null) ? 0 : oldTab.length; int oldThr = threshold; int newCap, newThr = 0; if (oldCap > 0) { if (原创 2021-06-07 13:16:30 · 185 阅读 · 0 评论