Wednesday, August 25, 2021

About Collections and Maps in Java

Today we are gonna have a brief view over the Collection and Map interfaces in Java:

As following diagram shows, while they are all used to save a group of objects of same types, Sets, Lists, Queues and Deques belong to the Collection interface, whereas Maps have their own interface.

Reference: https://www.codejava.net/java-core/collections/java-map-collection-tutorial-and-examples

----------------------------------------------------------------------------------------------------------------------

Friday, August 20, 2021

"Final" Keyword, Immutability and Thread Safety in Java

關於Java的Final關鍵字,Immutability與Thread Safety

1. Definition of "Thread safety": Multiple threads will access a shared object coordinately such that unsaved changes made by one thread would not be overwritten by the other.

How to achieve thread safety?