
java
RainbowXin
我们都在遗忘过去
展开
-
Java面试题- 集合的区别之HashMap 和 HashTable
线程安全: HashMap 是非线程安全的 HashTable是线程安全,内部的方法基本都是synchronized修饰 效率: 因为线程安全的问题,hashmap 要比hashtable 高,但hashtable 基本被淘汰,不要在代码中使用它。 对null key 和null value的支持 hashmap 键可以为null,但null value 可以有多个 ha...原创 2019-11-10 16:53:52 · 137 阅读 · 0 评论 -
剑指Offer-判断压栈顺序的正确性
关键的点在于 while 循环 判断,之前和 剩余 pop相等的元素 while(!push.isEmpty() && push.peek() == pop[index]){ push.pop(); index++; } public class IsPopOrder { public boolean IsPopOrde...原创 2019-11-07 13:53:21 · 135 阅读 · 0 评论