Just an interface.
当需要synchronized时候,使用List,如LiveData>
如果已知position:map 和 list get() 操作为O(1).
Hash table and linked list implementation of the Map interface
just an interface.
public abstract WordDao wordDao();
The Java volatile keyword is used to mark a Java variable as “being stored in main memory”. Use a synchronized in that case to guarantee that the reading and writing of the variable is atomic.
Reading and writing of volatile variables causes the variable to be read or written to main memory. Reading from and writing to main memory is more expensive than accessing the CPU cache. Accessing volatile variables also prevent instruction reordering which is a normal performance enhancement technique.
only use volatile variables when you really need to enforce visibility of variables.
https://www.youtube.com/playlist?list=PLZ9NgFYEMxp50tvT8806xllaCbd31DpDy
encapsulates the creation of a background process and the synchronization with the main thread. It also supports reporting progress of the running tasks.
AsyncTasks should ideally be used for short operations (a few seconds at the most.) If you need to keep threads running for long periods of time, it is highly recommended you use the various APIs provided by the java.util.concurrent package such as Executor, ThreadPoolExecutor and FutureTask.
A thread is a thread of execution in a program. The Java Virtual Machine allows an application to have multiple threads of execution running concurrently.
The Java Virtual Machine continues to execute threads until either of the following occurs:
(1) The exit method of class Runtime has been called and the security manager has permitted the exit operation to take place.
(2) All threads that are not daemon threads have died, either by returning from the call to the run method or by throwing an exception that propagates beyond the run method.
allows you to send and process Message and Runnable objects associated with a thread’s MessageQueue. Each Handler instance is associated with a single thread and that thread’s message queue.
There are two main uses for a Handler:
(1) to schedule messages and runnables to be executed at some point in the future;
(2) to enqueue an action to be performed on a different thread than your own.
A facility for threads to schedule tasks for future execution in a background thread. Tasks may be scheduled for one-time execution, or for repeated execution at regular intervals.
Implementation note: This class scales to large numbers of concurrently scheduled tasks (thousands should present no problem). Internally, it uses a binary heap to represent its task queue, so the cost to schedule a task is O(log n), where n is the number of concurrently scheduled tasks.
Subclasses must have a constructor which accepts Application as the only parameter.
来自MVVM 官方 Framework
因为有生命周期,常与LiveData一起用
Activity 与 Fragment之间数据传输是友好的