Record all kinds of pits encountered in development for easy review.

2020/11/12

When the company logs are filled in, the system returns to the first fragment and the fragment is loaded repeatedly.

A Data Parcel Size error occurs.

Use bundle.clear() to add data repeatedly. To solve the problem

2020/11/17

Base64 Image list oom optimized

Juejin. Cn/post / 689561…

2020/12/8

ALTER TABLE TCnAddrBookGroupInfo + “ADD COLUMN DWGroupContacterNum INTEGER” But since all class attributes using the @Entity annotation default to NOT NULL, you must add not NULL and specify a default value.

Complete SQL statement

"ALTER TABLE TCnAddrBookGroupInfo" + " ADD COLUMN dwgroupcontacternum INTEGER NOT NULL DEFAULT 0"
Copy the code

2020/12/9

The main differences between an ArrayList and a Vector.

Vector is guaranteed to be atomic operations, so single-thread operations can ensure thread safety. If multiple operations are used, add and remove at the same time will cause thread insecurity.

Thread unsafe arraylist itself, you can use the Collections. SynchronizedList () or CopyOnWriteArrayList ensure thread safety.

Collections.synchronizedList():

public static <T> List<T> synchronizedList(List<T> list) {
    return (list instanceof RandomAccess ?
            new SynchronizedRandomAccessList<>(list) :
            new SynchronizedList<>(list));
}
Copy the code

CopyOnWriteArrayList:

Copy On Write is also an important idea. In the scenario of less Write and more read, in order to ensure the thread safety of the collection, we can get a Copy of the original data in the current thread and then operate it. The JDK collections framework provides an implementation of ArrayList: CopyOnWriteArrayList. But if you’re not writing less and reading more, using CopyOnWriteArrayList is expensive, because each update operation (add/set/remove) makes a copy of the array.