wangpeipei90
wangpeipei90
You need to create a pull request so the author can merge it directly.
同意。语言的执行方式和OOP/POP没有必然的关系。从原理上来讲,OOP的语言也可以直接编译成字节码,而POP的语言也可以解释执行。
@guang19 驳斥一下你的观点。 你所说的两种单例模式没有区别的证据是两者单例对象生成的时间均为第一次加载的时候,并没有考虑多线程的环境。第二种单例模式的由来主要是因为多线程环境和指令重排的问题。 懒汉模式并没有考虑到多线程下A初始化单例对象后对B的可视化问题,也不能解决new Eager()时先得到索引,后分配空间的问题
@guankang1314 还是觉得题目的意思是两种设计模式实现之间的区别。
@wardseptember 运行时常量池 runtime constant pool 和 字符串常量池 string pool 不是一个概念。
https://github.com/Snailclimb/JavaGuide/blob/master/docs/java/jvm/Java%E5%86%85%E5%AD%98%E5%8C%BA%E5%9F%9F.md#26-%E8%BF%90%E8%A1%8C%E6%97%B6%E5%B8%B8%E9%87%8F%E6%B1%A0 JDK1.7之前运行时常量池逻辑包含字符串常量池存放在方法区, 此时hotspot虚拟机对方法区的实现为永久代 JDK1.7 字符串常量池被从方法区拿到了堆中, 这里没有提到运行时常量池,也就是说字符串常量池被单独拿到堆,运行时常量池剩下的东西还在方法区, 也就是hotspot中的永久代 。 JDK1.8 hotspot移除了永久代用元空间(Metaspace)取而代之, 这时候字符串常量池还在堆, 运行时常量池还在方法区, 只不过方法区的实现从永久代变成了元空间(Metaspace) 应该是1.7之前的JVM GC的机制
所以,在单线程的双枢纽元快速排序,多线程归并排序、多线程双枢纽元快速排序、小数组的直接插入排序和混合插入排序、相对有序数组的堆排序,还有 TimSort 当中,当对象数组类型不同时,Arrays.sort() 到底是怎么选择的?
In flashtext all keywords are stored in a trie dictionary tree structure, so the huge memory consumption is expected. For a trie with 26 alphabets, the least is 26 times....
Keyword matching in the reversed order won't work if the keywords are more than 3. For example, document = "ABC DEF GHI JKL" keywords = ["ABC DEF", "DEF GHI", "GHI...
I found similar problems with the `anythingBut` function. If I do `anythingBut('test')`, it actually turns the regex to be `[^test]`, which not only disallow "test" but also any other words...