mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-31 07:13:00 +00:00 
			
		
		
		
	Small code and doc improvements
Remove unnecessary else-branch and use Collections.isEmpty(). Add doc comment for splitFilename()
This commit is contained in:
		| @@ -102,9 +102,10 @@ public class StoredDirectoryHelper { | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (matches.size() < 1) { |         if (matches.isEmpty()) { | ||||||
|             return createFile(name, mime, true); |             return createFile(name, mime, true); | ||||||
|         } else { |         } | ||||||
|  |  | ||||||
|         // check if the filename is in use |         // check if the filename is in use | ||||||
|         String lcName = name.toLowerCase(); |         String lcName = name.toLowerCase(); | ||||||
|         for (final String testName : matches) { |         for (final String testName : matches) { | ||||||
| @@ -114,11 +115,10 @@ public class StoredDirectoryHelper { | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|             // check if not in use |         // create file if filename not in use | ||||||
|         if (lcName != null) { |         if (lcName != null) { | ||||||
|             return createFile(name, mime, true); |             return createFile(name, mime, true); | ||||||
|         } |         } | ||||||
|         } |  | ||||||
|  |  | ||||||
|         Collections.sort(matches, String::compareTo); |         Collections.sort(matches, String::compareTo); | ||||||
|  |  | ||||||
| @@ -261,6 +261,12 @@ public class StoredDirectoryHelper { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Splits the filename into the name and extension. | ||||||
|  |      * | ||||||
|  |      * @param filename The filename to split | ||||||
|  |      * @return A String array with the name at index 0 and extension at index 1 | ||||||
|  |      */ | ||||||
|     private static String[] splitFilename(@NonNull final String filename) { |     private static String[] splitFilename(@NonNull final String filename) { | ||||||
|         final int dotIndex = filename.lastIndexOf('.'); |         final int dotIndex = filename.lastIndexOf('.'); | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 TobiGr
					TobiGr