@Test public void givenAFilePathWithAContainerExtension_whenEndsWithJarOrApkExtension_thenReturnsTrue() { assertTrue(endsWithJarOrApkExtension(TEST_FILE_PATH_WITH_CONTAINER_EXTENSION)); }
public static boolean endsWithJarOrApkExtension(@NonNull String filePath) { checkPreconditionsOnFilePath(filePath); int initialCharacterOfAnExtensionIndex = filePath.lastIndexOf(DOT_SEPARATOR); if (initialCharacterOfAnExtensionIndex == -1) return false; String fileExtension = filePath.substring(initialCharacterOfAnExtensionIndex); return fileExtension.equalsIgnoreCase(APK_EXTENSION) || fileExtension.equalsIgnoreCase(JAR_EXTENSION); }
FileHelper { public static boolean endsWithJarOrApkExtension(@NonNull String filePath) { checkPreconditionsOnFilePath(filePath); int initialCharacterOfAnExtensionIndex = filePath.lastIndexOf(DOT_SEPARATOR); if (initialCharacterOfAnExtensionIndex == -1) return false; String fileExtension = filePath.substring(initialCharacterOfAnExtensionIndex); return fileExtension.equalsIgnoreCase(APK_EXTENSION) || fileExtension.equalsIgnoreCase(JAR_EXTENSION); } }
FileHelper { public static boolean endsWithJarOrApkExtension(@NonNull String filePath) { checkPreconditionsOnFilePath(filePath); int initialCharacterOfAnExtensionIndex = filePath.lastIndexOf(DOT_SEPARATOR); if (initialCharacterOfAnExtensionIndex == -1) return false; String fileExtension = filePath.substring(initialCharacterOfAnExtensionIndex); return fileExtension.equalsIgnoreCase(APK_EXTENSION) || fileExtension.equalsIgnoreCase(JAR_EXTENSION); }  }
FileHelper { public static boolean endsWithJarOrApkExtension(@NonNull String filePath) { checkPreconditionsOnFilePath(filePath); int initialCharacterOfAnExtensionIndex = filePath.lastIndexOf(DOT_SEPARATOR); if (initialCharacterOfAnExtensionIndex == -1) return false; String fileExtension = filePath.substring(initialCharacterOfAnExtensionIndex); return fileExtension.equalsIgnoreCase(APK_EXTENSION) || fileExtension.equalsIgnoreCase(JAR_EXTENSION); }  static String extractFilePathWithoutExtensionFromFilePath(@NonNull String filePath); static String extractFileNameWithoutExtensionFromFilePath(@NonNull String filePath); static String extractFileNameFromFilePath(@NonNull String filePath); static Optional<String> extractExtensionFromFilePath(@NonNull String filePath); static boolean endsWithJarOrApkExtension(@NonNull String filePath); }
FileHelper { public static boolean endsWithJarOrApkExtension(@NonNull String filePath) { checkPreconditionsOnFilePath(filePath); int initialCharacterOfAnExtensionIndex = filePath.lastIndexOf(DOT_SEPARATOR); if (initialCharacterOfAnExtensionIndex == -1) return false; String fileExtension = filePath.substring(initialCharacterOfAnExtensionIndex); return fileExtension.equalsIgnoreCase(APK_EXTENSION) || fileExtension.equalsIgnoreCase(JAR_EXTENSION); }  static String extractFilePathWithoutExtensionFromFilePath(@NonNull String filePath); static String extractFileNameWithoutExtensionFromFilePath(@NonNull String filePath); static String extractFileNameFromFilePath(@NonNull String filePath); static Optional<String> extractExtensionFromFilePath(@NonNull String filePath); static boolean endsWithJarOrApkExtension(@NonNull String filePath); static final String DOT_SEPARATOR; static final String APK_EXTENSION; static final String JAR_EXTENSION; }