- 博客(6)
- 收藏
- 关注
原创 AtomicInteger
AtomicInteger,一个提供原子操作的Integer,是线程安全的。多线程使用,计算线程数是否超出最大允许的线程数。private AtomicInteger count = new AtomicInteger(); public void increment() { count.incrementAndGet(); } //使用AtomicInteger之后,不需要加锁,也可以实现线程安全。 public
2021-08-03 19:06:47 313
原创 CopyOnWriteArrayList
ArrayList是非线程安全的,多线程下读写,会出现问题,会抛出ConcurrentModificationExceptionList<String> listStr = new ArrayList<>();listStr.add("1");listStr.add("2");listStr.add("3");List<String> temp = listStr;Iterator<String> it = listStr.interator();
2021-08-02 16:52:21 86
原创 第一次提交代码到git
进入需要上传的项目文件夹,右键打开git.bash。(1)、使用 git init 命令 ,初始化一个git 本地仓库此时会在本地创建一个 .git 的文件夹,一般这个文件夹是隐藏的(2)、将刚刚建立的仓库的路径复制(3)、使用git remote add origin https…(刚刚复制的路径名称) ,添加远程仓库到本地(4)、使用 git pull origin master 命令,将码云上的仓库pull到本地文件夹(5)、使用git add . (. 表示所有的)或者 git add
2021-05-25 15:30:39 183
原创 springboot项目搭建采坑记——jar包版本问题
用idea创建springboot项目,jar包都是默认的最新版本。本地运行没问题,放到服务器上报错,后来再本地也开始报错。报错如下:org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [com.xhl.timeline.TimelineApplication]; nested exception is jav
2021-05-09 11:19:44 566
原创 位运算符—异或
每日一题——位运算符136.只出现一次的数字给定一个非空整数数组,除了某个元素只出现一次以外,其余每个元素均出现两次。找出那个只出现了一次的元素。题解:public int singleNumber(int[] nums){ int res = 0; for(int i : nums){ res ^= i; } return res;}389.找不同给定两个字符串 s 和 t,它们只包含小写字母。字符串 t 由字符串 s 随机重排,然后在随机
2021-03-10 16:28:29 126
原创 乱码问题-Quoted-printable编码
Quoted-printable编码收到邮件客户端打开显示乱码,跟网页源代码很像,但是有很多“3D”,“=”这些,邮件头中有Content-Transfer-Encoding:quoted-printable这样的代码。从网上找了一下,是Quoted-printable编码的问题。它是多用途互联网邮件扩展(MIME)的一种实现方式。MIME是一个互联网标准,它扩展了电子邮件标准,致力于使其能够支持非ASCII字符、二进制格式附件等多种格式的邮件消息。目前http协议中,很多采用MIME框架!就是说用一些
2021-03-10 16:18:29 1152
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人