2016年2月14日
摘要:
首先贴一下overstack上的一个回答: 理解: (1)throws InterruptedException是你方法声明的一部分,也是你调用方法的返回值。 (2)当你的方法调用另一个方法的时候抛出了InterruptException异常,你就应该思考:InterruptException对于你
阅读全文
posted @ 2016-02-14 18:21
gyt929458988
阅读(252)
推荐(0)
2016年2月12日
摘要:
今天上网搜了下闭锁和信号量适用的场合,OverStatckFlow上的一个回答挺好的,如下 理解:闭锁适用于启动一系列的线程并等待他们执行完毕(或者是调用了一定次数的countDown函数).信号量是用来控制多个线程共享某个资源.这个资源可以是文件或者是cpu.信号量的数量可以增加也可以减少. 原文
阅读全文
posted @ 2016-02-12 15:46
gyt929458988
阅读(836)
推荐(0)
摘要:
This is an example of how to use the AtomicInteger class of Java. Thejava.util.concurrent.atomic package provides very useful classes that support loc
阅读全文
posted @ 2016-02-12 10:25
gyt929458988
阅读(316)
推荐(0)
2016年2月9日
摘要:
LinkedHashSet is an extended version of HashSet. HashSet doesn’t follow any order where as LinkedHashSet maintains insertion order. HashSet uses HashM
阅读全文
posted @ 2016-02-09 19:41
gyt929458988
阅读(1737)
推荐(1)
摘要:
A Set contains no duplicate elements. That is one of the major reasons to use a set. There are 3 commonly used implementations of Set: HashSet, TreeSe
阅读全文
posted @ 2016-02-09 17:11
gyt929458988
阅读(714)
推荐(0)
摘要:
As you already know, LinkedHashSet is an ordered version of HashSet. That means, HashSet doesn’t maintain any order where as LinkedHashSet maintains i
阅读全文
posted @ 2016-02-09 16:50
gyt929458988
阅读(324)
推荐(0)
摘要:
TreeSet is another popular implementation of Set interface along with HashSet and LinkedHashSet. All these implementations of Set interface are requir
阅读全文
posted @ 2016-02-09 15:41
gyt929458988
阅读(225)
推荐(0)
摘要:
Arraylist,HashMap,HashSet等容器持有的的fail-fast迭代器,具体实现原理和modcount域有关. Lets looks at following code 01 public class FailFastIteratorTest { 02 03 public stat
阅读全文
posted @ 2016-02-09 10:49
gyt929458988
阅读(418)
推荐(0)
摘要:
今天看hashmap源码的时候遇见了fail-fast这个名词,找了一篇博客,学习一下: What is fail safe and fail fast Iterator in Java? Java Collections supports two types of Iterator, fail s
阅读全文
posted @ 2016-02-09 09:21
gyt929458988
阅读(742)
推荐(0)
2016年2月8日
摘要:
一. 首先贴一篇解释transient关键字的文章 What is transient keyword in Java? This article explains about the transient variable and when it will be used in the Java p
阅读全文
posted @ 2016-02-08 14:02
gyt929458988
阅读(859)
推荐(0)