boolean自然排序顺序
发表于|更新于
|浏览量:
聪明人警告我说,生命只是荷叶上的一颗露珠。——泰戈尔
代码如下:
1 | import java.util.ArrayList; |
输出如下:
1 | [false, true] |
因此java中自然排序,false是小于true的
这里可以用一般orm的boolean转换为int来方便记忆
false为0
true为1
因此false小于true
相关推荐
2021-02-22
获取系统信息
人不读书,则尘俗生其间,照镜则面目可憎,对人则语言无味。一一北宋·黄庭坚 首先是依赖 123456<!-- 获取系统信息 --><dependency> <groupId>com.github.oshi</groupId> <artifactId>oshi-core</artifactId> <version>3.9.1</version></dependency> 然后是工具类 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511...
2021-10-23
ThreadLocal子线程共享
世人缺乏的是毅力,而非气力。——雨果 昨天聊了ThreadLocal可以用作单个线程中变量共享 其底层实现其实就是个Map,用线程作为key,不信可以看这部分源码: 123456789101112131415161718192021/** * Returns the value in the current thread's copy of this * thread-local variable. If the variable has no value for the * current thread, it is first initialized to the value returned * by an invocation of the {@link #initialValue} method. * * @return the current thread's value of this thread-local */public T get() { Thread t = Thread.currentThr...
2024-03-03
apache-tika从ppt-pdf-xls读取文本
你若要喜爱自己的价值,你就得给世界创造价值。——歌德 代码仓库: GitHub - apache/tika: The Apache Tika toolkit detects and extracts metadata and text from over a thousand different file types (such as PPT, XLS, and PDF). 官网: https://tika.apache.org/ 快速开始: Apache Tika – Getting Started with Apache Tika 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610...
2020-11-29
@Transactional
事者,生于虑,成于务,失于傲。——管仲 如果想让该类或方法被事务支持,则可以加上@Transactional注解@Transactional有几个参数:value/transactionManager——是用来指定事务管理器,这个不太常用timeout——事务超时时间,为传播特性为PROPAGATION_REQUIRES_NEW和PROPAGATION_REQUIRED定制,创建新事务时旧事务的超时时间,出场率也不是特别高下面的则是常用的参数readOnly——是否为只读事务,如果为true时,进行查询操作效率会更高,但不能进行除查询外的操作,会报错rollbackFor/rollbackForClassName——指定需要回滚的异常noRollbackFor/noRollbackForClassName——指定不需要回滚的异常默认对编译异常不会滚 对非受检异常回滚,例如RuntimeException就会回滚事务 isolation——配置隔离级别事务丢失 回滚丢失——另一个事务回滚导致当前事务丢失 覆盖丢失——另一个事务提交导致当前事务丢失 ...
2020-11-18
使用stream流连接两个list
生命如同寓言,其价值不在于长短,而在于内容—— 塞涅卡 1234567List<Integer> integerList = Arrays.stream(new int[]{1, 2, 3}).boxed().collect(Collectors.toList());List<Integer> collect = Stream.concat(integerList.stream(), integerList.stream()).collect(Collectors.toList());collect.forEach(System.out::print);System.out.println();collect = Stream.of(integerList, integerList).flatMap(List::stream).collect(Collectors.toList());collect.forEach(System.out::print);System.out.println();
2023-10-09
nextrtc-videochat-with-rest
个人利益永远包括在公共利益之中,要想和公共利益分离,等于自取灭亡。——孟德斯鸠 介绍一个java的webrtc实现,虽然项目很老了,但也具备一定的参考价值 https://github.com/mslosarz/nextrtc-videochat-with-rest 这里用到的技术包括spring security, spring rest, spring jpa等

阿超
我的名字叫阿超 年龄25岁 家在北京市 职业是软件开发 每天最晚也会在八点前回家 不抽烟 酒浅尝辄止 晚上十二点上床 保证睡足八个小时 睡前写一篇博客 再做二十分钟俯卧撑暖身 然后再睡觉 基本能熟睡到天亮 像婴儿一样不留下任何疲劳和压力 就这样迎来第二天的早晨 健康检查结果也显示我很正常 我想说明我是一个不论何时都追求内心平稳的人 不拘泥于胜负 不纠结于烦恼 不树立使我夜不能寐的敌人 这就是我在这社会的生活态度
Follow Me公告
This is my Blog