![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
java基础
假想,奔跑
皆以
展开
-
集合排序
List<QdCodeInfoCacheDO> collections; Collections.sort(collections, new Comparator<QdCodeInfoCacheDO>() { @Override public int compare(QdCodeInfoCacheDO o1, QdCodeInfoCacheDO o2) { return o2.getCodeType().compareTo(o1.getCodeTyp.原创 2021-02-19 14:35:36 · 103 阅读 · 0 评论 -
HashMap
Map<Integer, Integer> map = new HashMap<Integer, Integer>(); for(Map.Entry<Integer, Integer> entry : map.entrySet()){ System.out.println("key = " + entry.getKey() + ", value = " + entry.getValue()) }原创 2020-11-30 17:33:19 · 112 阅读 · 0 评论 -
Double计算
Double减法计算 Double a = new Double(2.03); Double b = new Double(0); Double c = new Double(1.33); Double v = new BigDecimal(a.doubleValue()).add(new BigDecimal(b.doubleValue())).subtract(new BigDecimal(c.doubleValue())).doubleValue(); Doub原创 2020-11-17 11:40:58 · 1092 阅读 · 0 评论 -
java enum 枚举
public class StatusEnums { /** * 0 异常/删除/ 立即发布 * 1 正常 /定时发布 */ @Getter @AllArgsConstructor public static enum IsError { ERROR(0, "异常"), NOTERROR(1, "正常"); private final Integer value; private final String name; public static String getName(Integ原创 2020-11-03 18:21:54 · 74 阅读 · 0 评论 -
DCL
双重校验锁 double check lock public class Singleton { private static volatile Singleton singleton; private Singleton() { } public Singleton getInstance() { if (null == singleton) { synchronized (Singleton.class) { if (null == singleton) { s原创 2020-10-16 11:33:37 · 123 阅读 · 0 评论 -
java多线程
一 线程的创建方式 1 继承Thread类 Thread 类本质上是实现了 Runnable 接口的一个实例,代表一个线程的实例。启动线程的唯一方法就是通过 Thread 类的 start()实例方法。start()方法是一个 native 方法,它将启动一个新线程,并执行 run()方法。 public class MyThread extends Thread { @Override public void run() { System.out.println("run"原创 2020-07-15 15:59:59 · 89 阅读 · 0 评论 -
BigDecimal算法
BigDecimal bignum1 = new BigDecimal(“10”); BigDecimal bignum2 = new BigDecimal(“5”); BigDecimal bignum3 = null; //加法 bignum3 = bignum1.add(bignum2); System.out.println(“和 是:” + bignum3); //减法 bignum3 = bignum1.subtract(bignum2); System.out.println(“差 是:” +原创 2020-06-02 20:01:38 · 480 阅读 · 0 评论 -
java8 lamba
java 时间操作 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date currentDate = new Date(System.currentTimeMillis()); Calendar calender = Calendar.get...原创 2019-12-24 14:24:18 · 163 阅读 · 0 评论 -
java对象任何一个属性都不为空
java对象任何一个属性都不为空 WechatActivationVo wechatActivationVo = new WechatActivationVo(); for (Field f : wechatActivationVo.getClass().getDeclaredFields()) { f.setAccessible(true); if (f.get(...原创 2019-09-25 13:43:03 · 1693 阅读 · 0 评论