kuko126's recent timeline updates
kuko126
ONLINE

kuko126

V2EX member #46731, joined on 2013-10-13 09:47:48 +08:00
Per kuko126's settings, the topics list is hidden
Deals info, including closed deals, is not hidden
kuko126's recent replies
https://www.bilibili.com/video/BV1X54y1Q75J
这个视频是讲的 java 的,里面的缓存失效部分应该是一致的,不知道能不能解答你的疑问
Mar 25, 2021
Replied to a topic by szuwl 程序员 怎样理解下面这段代码
Mar 25, 2021
Replied to a topic by szuwl 程序员 怎样理解下面这段代码
List<? super Number> arr = Arrays.asList(1,2,3.1f,4.1d);
arr.add(Integer.valueOf(1));
不会编译错误
Dec 19, 2018
Replied to a topic by yidinghe 奇思妙想 最新的伪人工智能演示( Java )
JavaAgent 加载了另外的 jar 包?
如果有三个及以上参数 就要用 (a, b, c) -> a.func(b, c); 这种形式
要权威的话可以看下这个 https://docs.oracle.com/javase/tutorial/java/javaOO/methodreferences.html
Oct 24, 2018
Replied to a topic by cc959798 MySQL mysql mvcc 机制控制幻读问题
@cc959798 mysql 的 RR 是解决了幻读问题的 所以看不到
Oct 24, 2018
Replied to a topic by cc959798 MySQL mysql mvcc 机制控制幻读问题
看你事务隔离级别,RR 下 B 看不到 A 的插入是正常的
方法引用的几种写法,其中有
类名::实例方法名
若 Lambda 表达式的参数列表的第一个参数,是实例方法的调用者,第二个参数(或无参)是实例方法的参数时,就可以使用这种方法
https://blog.csdn.net/TimHeath/article/details/71194938
所以可以从
BiConsumer<List<String>, String> v = (list1, s) -> list1.add(s);
转换成
BiConsumer<List<String>, String> v = List::add;

2 是因为泛型不写默认就是 Object,Object 里没有 add 方法所以编译会报错
可以试一下下面的看一下区别
BiConsumer<List<String>, String> v = (list1, s) -> list1.add(s);
BiConsumer<List<String>, String> v = ArrayList::add;
BiConsumer v = Object::equals;
Aug 4, 2017
Replied to a topic by aznfy Java 求教一个 Java generic 的问题
@aznfy 第二个里面 T 只是 Comparable<T>的子类 如果你的 SecondClass 实现了 Comparable<E>那就不行了
下面代码可以编译通过
public class FirstClass<E extends Comparable<E>, T extends SecondClass<E> & Comparable<T>> {
public void compare(T t1, T t2) {
t1.compareTo(t2);
}

public static void main(String[] args) {
FirstClass<String, ThirdClass> firstClass = new FirstClass<>();
ThirdClass t1 = new ThirdClass(1);
ThirdClass t2 = new ThirdClass(2);

firstClass.compare(t1, t2);
}

static class ThirdClass extends SecondClass<String> implements Comparable<ThirdClass> {
int i;

public ThirdClass(int i) {
this.i = i;
}

@Override
public int compareTo(ThirdClass o) {
return 0;
}
}

}
Aug 4, 2017
Replied to a topic by aznfy Java 求教一个 Java generic 的问题
@aznfy 那是要这样子的?
public class FirstClass<E extends Comparable<E>, T extends SecondClass<E> & Comparable<T>> {

public void compare(T t1, T t2) {
t1.compareTo(t2);
}

}
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1064 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 15ms · UTC 22:58 · PVG 06:58 · LAX 15:58 · JFK 18:58
♥ Do have faith in what you're doing.