随笔分类 - java
jdk、jvm
摘要:文件操作 工作目录 @Test public void testFilePath (){ //项目的工作路径 System.out.println(System.getProperty("user.dir")); //绝对路径,window下是D:\log\log.txt File file = n
阅读全文
摘要:简单Stream示例 @Test public void test (){ getData().stream().filter(person -> person.getAge() >24).map(Person::getName).forEach(System.out::println); } pr
阅读全文
摘要:Spliterator接口 Spliterator(splitable iterator可分割迭代器)接口是Java为了并行遍历数据源中的元素而设计的迭代器,这个可以类比最早Java提供的顺序遍历迭代器Iterator,但一个是顺序遍历,一个是并行遍历。 public interface Split
阅读全文
摘要:理解Stream.collect()方法 /**伪代码如下 * <pre>{@code * R result = supplier.get(); * for (T element : this stream) * accumulator.accept(result, element); * retu
阅读全文
摘要:UML 操作分类 中间操作 有状态 无状态 终结操作 短路操作 非短路操作 uml Stream接口 public interface Stream<T> extends BaseStream<T, Stream<T>> { //返回一个包含所有符合predicate的元素的Stream //是一个
阅读全文
摘要:匿名函数 ::操作符 A static method (ClassName::methName) An instance method of a particular object (instanceRef::methName) A super method of a particular obje
阅读全文
摘要:java.time jdk引入新的时间体系: LocalDate只保留日期 LocalTime只保留时间 LocalDateTime同时保留时间和日期 ZonedDateTime保留了时区、时间、日期 Instant:是不带时区一个时时间点,与java.util.Date类似,但是精确到纳秒。 @T
阅读全文
摘要:java.util.Date 概述 Date类实际上是对long值的封装,long值表示当前计算机时间和GMT时间(格林威治时间)1970年1月1号0时0分0秒所差的毫秒数。可从构造函数看出来: public Date() { this(System.currentTimeMillis()); }
阅读全文
摘要:Thread线程池 简述 jdk的并发相关类,在java.util.concurrent中,主要包括: 线程安全的集合,ConcurrentHashMap 阻塞队列,如LinkedBlockingDeque 线程池,ThreadPoolExcutor AQS锁,如ReentrantLock 线程安全
阅读全文

浙公网安备 33010602011771号