Browse Source

operations: Replace use of Vector with a unsynchronized equivalent.

Early classes of the Java API, such as Vector, Hashtable and StringBuffer, were synchronized to make them thread-safe. Unfortunately, synchronization has a big negative impact on performance, even when using these collections from a single thread.

It is better to use their new unsynchronized replacements. ArrayList is pretty much a drop-in replacement for Vectors and I cant see any reason to use Vector unless there is some sort of special requirement for it. ArrayList will generally give you better performance and only half the data growth when items are added to the list.
ardevd 6 năm trước cách đây
mục cha
commit
62c4836fc1

+ 1 - 1
src/main/java/com/owncloud/android/operations/RefreshFolderOperation.java

@@ -360,7 +360,7 @@ public class RefreshFolderOperation extends RemoteOperation {
 
 
         Log_OC.d(TAG, "Remote folder " + mLocalFolder.getRemotePath() + " changed - starting update of local data ");
         Log_OC.d(TAG, "Remote folder " + mLocalFolder.getRemotePath() + " changed - starting update of local data ");
 
 
-        List<OCFile> updatedFiles = new Vector<>(folderAndFiles.size() - 1);
+        List<OCFile> updatedFiles = new ArrayList<>(folderAndFiles.size() - 1);
         mFilesToSyncContents.clear();
         mFilesToSyncContents.clear();
 
 
         // if local folder is encrypted, download fresh metadata
         // if local folder is encrypted, download fresh metadata