自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(9)
  • 收藏
  • 关注

原创 JAVA Classloader

当程序要使用某个类时,如果该类还未被加载到内存中,则系统会通过加载,连接,初始化三步,将其加载到内存中,最终形成可以被虚拟机直接使用的Java类型。 下面看一个例子 public class SingleTon { /** * x = 0; * y = 0; * singleton =null; * * x=0...

2019-08-19 16:07:41 100

原创 CountDownlatch的使用

CountDownLatch类位于java.util.concurrent包下,利用它可以实现类似计数器的功能。比如有一个任务A,它要等待其他4个任务执行完毕之后才能执行,此时就可以利用CountDownLatch来实现这种功能。 countdownlatch内部通过继承AQS实现的一个sync来实现。重写了tryAcquireShared 和tryReleaseShared 方法...

2019-08-06 17:08:59 155

原创 基于java8的hashmap 源码分析

1.HashMap简介 一.什么是Hash?什么是HashMap? Hash音译为“哈希”,直译为“散列”,是一种信息摘要算法,但他不是加密。散列函数(或散列算法,又称哈希函数,英语:Hash Function)是一种从任何一种数据中创建小的数字“指纹”的方法。散列函数把消息或数据压缩成摘要,使得数据量变小,将数据的格式固定下来。该函数将数据打乱混合,重新创建一个叫做散列值(ha...

2019-08-02 13:47:08 85

原创 设计模式:Singleton(单例模式)

定义: 单例模式是GOF二十三中经典设计模式的简单常用的一种设计模式,单例模式的基本结构需满足以下要求。 单例模式的核心结构只有一个单例类,单例模式要保证这个类在运行期间只能被实例化一次,即只会被创建唯一的一个单例类的实例。 单例模式需要提供一个全局唯一能得到这个类实例的访问点,一般通过定义一个名称类似为GetInstance的公用方法实现这一目的。 实现: 恶汉式单例模式,当JVM加载类...

2019-07-24 16:19:24 88

原创 设计模式:Observer 观察者模式

定义:   在对象之间定义了一对多的依赖,这样一来,当一个对象改变状态,依赖它的对象会收到通知并自动更新。 大白话:   其实就是发布订阅模式,发布者发布信息,订阅者获取信息,订阅了就能收到信息,没订阅就收不到信息。 类图: 例子: 恭喜贵公司获选为敝公司建立下一代Internet气象观测站! 该气象站必须建立在我们专利申请中的WeatherData对象 上,由Wea...

2019-07-23 10:16:25 64

转载 LEETCODE-4: Median of Two Sorted Arrays

题目 There are two sorted arraysnums1andnums2of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). You may assumenums1a...

2019-07-18 13:25:27 55

原创 LEETCODE-3:Longest Substring Without Repeating Characters

题目 Given a string, find the length of thelongest substringwithout repeating characters. Example 1: Input: "abcabcbb" Output: 3 Explanation: The answer is "abc", with the length of 3. Example ...

2019-07-17 15:17:41 91

原创 LEETCODE-2 :ADD TWO NUMBERS

You are given twonon-emptylinked lists representing two non-negative integers. The digits are stored inreverse orderand each of their nodes contain a single digit. Add the two numbers and return i...

2019-07-17 15:06:37 85

原创 LEETCODE -1: TWOSUM

题目 Given an array of integers, returnindicesof the two numbers such that they add up to a specific target. You may assume that each input would haveexactlyone solution, and you may not use thes...

2019-07-17 14:38:05 57

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除