搞定HashMap底层源码

视频教程

https://www.bilibili.com/video/av63831182?from=search&seid=8554691791196685337

package com.itcast;/**
 * @author n00444323
 * @date 2019/6/5 17:14
 */

import org.springframework.jndi.JndiObjectTargetSource;
import org.springframework.util.StringUtils;
import org.springframework.util.SystemPropertyUtils;

import java.util.HashMap;
import java.util.Map;

/**
 * @param
 * @return
 * @throws
 */
public class HashMapTest {

    public static void main(String[] args) {

        String[] array = new String[10];
        array[0] = "000";
        array[1] = "111";
        array[2] = "222";
        array[1] = "333";
        //这里会覆盖
        System.out.println(array[1]); //333


        //我想存储对象怎么办
        Student[] students = new Student[10];
        students[0] = new Student("张三", "19", "男");
        students[1] = new Student("李四", "20", "男");

        for (int i = 0; i < students.length; i++) {
            Student student = students[i];
            System.out.println(student);
        }

        //其实hashMap的本质是数组和链表,存储结构如图所示
        Map map = new HashMap();
        map.put("aaa", "111");
        map.put("bbb", "222");
        map.put("ccc", "333");
        map.put("ddd", "444");
    }


}

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值