所有实现类(例如 [HashMap](//howtodoinjava.com/java/collections/how-hashmap-works-in-java/"How hashmap works in java") ,HashTable,TreeMap 或 [WeakHashMap](https://docs.oracle.com/javase/7/docs/api/java/util/WeakHashMap.html"WeakHashMap") )都不同地实现了所有方法,因此与其他方法相比具有不同的功能。
简而言之, [**并发**](https://en.wikipedia.org/wiki/Concurrency_%28computer_science%29) 是并行运行多个程序或程序的多个部分的能力。 并发使程序可以通过利用底层操作系统和机器硬件的未开发功能来实现高性能和吞吐量。 例如现代计算机在一个 CPU 中具有多个 CPU 或多个内核,程序可以将所有内核用于处理的某些部分; 因此,与顺序处理相比,可以更早地完成任务。
简而言之, [**并发**](https://en.wikipedia.org/wiki/Concurrency_%28computer_science%29) 是并行运行多个程序或程序的多个部分的能力。 并发使程序可以通过利用底层操作系统和机器硬件的未开发功能来实现高性能和吞吐量。 例如现代计算机在一个 CPU 中具有多个 CPU 或多个内核,程序可以将所有内核用于处理的某些部分; 因此,与顺序处理相比,可以更早地完成任务。
[**Java 并发**](https://howtodoinjava.com/java-concurrency-tutorial/"multithreading in java") 是一个非常复杂的主题,在编写处理在任何给定时间访问一个/多个共享资源的多个线程的应用程序代码时,需要引起很多关注。 Java 5 引入了诸如 [**BlockingQueue**](https://howtodoinjava.com/java/multi-threading/how-to-use-blockingqueue-and-threadpoolexecutor-in-java/"How to use BlockingQueue and ThreadPoolExecutor in java") 和 **Executors** 之类的类,它们通过提供易于使用的 API 消除了一些复杂性。
Java 线程间通信在很长一段时间以来一直是热门的[面试问题](https://howtodoinjava.com/java-interview-questions/)。 在 JDK 1.5 版本中, [ExecutorService](https://howtodoinjava.com/java/multi-threading/java-executor-framework-tutorial-and-best-practices/) 和 [BlockingQueue](https://howtodoinjava.com/java/multi-threading/how-to-use-blockingqueue-and-threadpoolexecutor-in-java/) 为[带来了另一种更有效的实现方式](//howtodoinjava.com/java-5/how-to-use-blockingqueue-and-threadpoolexecutor-in-java/"How to use BlockingQueue and ThreadPoolExecutor in java"),但管道流方法也值得了解,在某些情况下可能有用 场景。
Java 线程间通信在很长一段时间以来一直是热门的[面试问题](https://howtodoinjava.com/java-interview-questions/)。 在 JDK 1.5 版本中, [ExecutorService](https://howtodoinjava.com/java/multi-threading/java-executor-framework-tutorial-and-best-practices/) 和 [BlockingQueue](https://howtodoinjava.com/java/multi-threading/how-to-use-blockingqueue-and-threadpoolexecutor-in-java/) 为[带来了另一种更有效的实现方式](//howtodoinjava.com/java-5/how-to-use-blockingqueue-and-threadpoolexecutor-in-java/"How to use BlockingQueue and ThreadPoolExecutor in java"),但管道流方法也值得了解,在某些情况下可能有用。
4. A good way to define method signatures is to declare exceptions close to method name. If your method is named `openFile`, then it is expected to throw `FileNotFoundException`?. If your method is named `findProvider`, then it is expected to throw `NoSuchProviderException`.
@@ -85,7 +85,7 @@ multiple non-overriding abstract methods found in interface MyFirstFunctionalInt
* If an interface declares an ***abstract method overriding one of the public methods of `java.lang.Object`, that also does not count toward the interface’s abstract method count*** since any implementation of the interface will have an implementation from java.lang.Object or elsewhere. e.g. [**Comparator**](//howtodoinjava.com/search-sort/when-to-use-comparable-and-comparator-interfaces-in-java/ "When to use comparable and comparator interfaces in java") is a functional interface even though it declared two abstract methods. Why? Because one of these abstract methods “`equals()`” which has signature equal to `public` method in `Object` class.