![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
java
文章平均质量分 54
云梦九章
这个作者很懒,什么都没留下…
展开
-
HashMap知识循序渐进分析
红黑树(一)之 原理和算法详细介绍【老实李】JDK1.8中HashMap的红黑树hashcode详解 HashMap底层实现原理及面试问题原创 2020-12-01 15:39:37 · 9019 阅读 · 0 评论 -
java boolean占用内存大小
答案:4B或1B详细如果boolean是单独使用:boolean占4个字节。如果boolean是以boolean数组形式使用:boolean占4个字节解释JVM没有提供boolean类型专用的字节指令,而是使用int相关指令来代替。对boolean数组的访问与修改,会共用byte数组的baload和bastore指令。分析结论上面的第一个结论是说:boolean在底层实际调用int,那么既然int占4个字节,boolean页自然占4个字节。即 boolean类型占4个字节。上面的原创 2021-02-23 20:39:34 · 6075 阅读 · 2 评论 -
java-常见缩写
POJO:Plain Ordinary Java Object)简单的Java对象RPC:全称Remote Procedure Call——远程过程调用EJB:Enterprise Bean,也就是Enterprise JavaBean(EJB),是J2EE的一部分,定义了一个用于开发基于组件的企业多重应用程序的标准。其特点包括网络服务支持和核心开发工具(SDK)。PO:persistent object持久对象。O/R Mapping 是 Object Relational Mapping(对象关.原创 2021-02-20 10:42:13 · 4901 阅读 · 0 评论 -
java多线程--集合并发
1.问题引入:1.1常见的list获取最后一个对象。Object haha = list.get(list.size() - 1);大致看起来没有问题。但是这个代码在多线程情况下就会出java.lang.ArrayIndexOutOfBoundsException1.2 为什么呢?如下测试代码 @Test public void testSynchronizedList() throws Exception { long fisrtTime = System原创 2021-02-08 17:16:07 · 5076 阅读 · 5 评论 -
双重检查加锁损坏宣言(The “Double-Checked Locking is Broken“ Declaration)
问题:// Broken multithreaded version// "Double-Checked Locking" idiomclass Foo { private Helper helper = null; public Helper getHelper() { if (helper == null) { synchronized(this) { if (helper == null) {原创 2021-01-28 14:45:06 · 4569 阅读 · 0 评论 -
java:多线程实测
如下各种组合代码:public class ExampleUnitTest { private AtomicLong aTest1 = new AtomicLong(0); private static AtomicLong aTest2 = new AtomicLong(0); private volatile AtomicLong aTest3 = new AtomicLong(0); private static volatile AtomicLong aTest4原创 2020-12-24 13:00:33 · 5093 阅读 · 0 评论 -
java,android:判断当前时间是否属于该时间段
自己写的一方法 /** * judge the current time is on the time, for example: current is 11:00, startTimeStringFormat=10:00,endTimeStringFormat==12:00,you will get true * * @param startTimeStringFormat String:"HH:mm" you must follow the format原创 2020-12-04 11:16:37 · 8230 阅读 · 0 评论 -
SystemClock.uptimeMillis与System.currentTimeMillis对比
这两种方法有何区别呢?SystemClock.uptimeMillis() // 从开机到现在的毫秒数(手机睡眠的时间不包括在内);System.currentTimeMillis() // 从1970年1月1日 UTC到现在的毫秒数;第2个时间,是可以通过System.setCurrentTimeMillis修改的,那么,在某些情况下,一但被修改,时间间隔就不准了特别说明点:AnimationUtils 中明确说了:/** * Returns the current animat原创 2020-12-01 14:52:30 · 12071 阅读 · 4 评论 -
定时轮询:rxjava2实现
Observable.interval(1, TimeUnit.SECONDS) .doOnNext(new Consumer<Long>() { @Override public void accept(Long aLong) throws Exception { System.out.println(aLong); ...原创 2020-12-01 14:19:04 · 9247 阅读 · 0 评论 -
java TCP链接Client base OKsoket
import com.alibaba.fastjson.JSON;import com.geely.soahmi.ui.main.beas.RootBean;import com.geely.soahmi.utils.LogTest;import com.xuhao.didi.core.iocore.interfaces.IPulseSendable;import com.xuhao.d...原创 2020-11-30 19:32:55 · 9637 阅读 · 0 评论 -
测试方法性能
import android.annotation.SuppressLint;import android.os.Environment;import java.io.File;import java.text.SimpleDateFormat;/** * the class used in test the cpu * <p> * step 1:permissi...原创 2020-11-30 19:32:11 · 9141 阅读 · 0 评论 -
UDP发送接受工具
UDP监听工具:import java.io.IOException;import java.net.DatagramPacket;import java.net.DatagramSocket;import java.net.InetSocketAddress;public class UdpReceive { private boolean isRunning = fal...原创 2020-03-18 15:08:24 · 10551 阅读 · 1 评论