
corejava
learnTech
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
indexOf() substring()
字符串string中 包含某个 字符串string。 可以用indexOf(). if(str.indexOf("abc") >= 0){ // 字符串str中存在'abc' }else{ //不存在 } str.substring():其中str 下标从0开始 substring(int) "unhappy".substring(2) return "原创 2013-01-22 12:32:01 · 464 阅读 · 0 评论 -
TreeMap HashMap
两种常规Map实现(分别继承自AbstractMap和SortedMap) HashMap:基于哈希表实现。使用HashMap要求添加的键类明确定义了hashCode()和equals()[可以重写hashCode()和equals()],为了优化HashMap空间的使用,您可以调优初始容量和负载因子。 (1)HashMap(): 构建一个空的哈希映像 (2)HashMap(Ma转载 2013-01-22 17:12:44 · 512 阅读 · 0 评论 -
Thread wait() join(), notify() notifyAll() sleep(),yield()
锁定义在object类,而不是Thread类 wait(), notify() synchronized会对锁进行操作,wait()使当前线程等待,释放所持有的锁,通过notify()唤醒其他的等待线程,是谁唤醒他们的呢?是“唤醒线程”,它只有获得操作对象的锁,才能去唤醒等待线程,此时等待线程还不能运行,这就需要唤醒线程释放持有的锁,其他线程才能获得锁去执行。wait(),notify()依赖锁...转载 2018-12-05 15:05:30 · 233 阅读 · 0 评论 -
三种实现线程“异步”
join() public static void main(String[] args) throws InterruptedException { // TODO Auto-generated method stub ThreadCase t = new ThreadCase(); t.start(); ...原创 2018-12-05 15:13:07 · 827 阅读 · 0 评论