Package com.norconex.commons.lang.jar

# Class JarDuplicateFinder

java.lang.Object
com.norconex.commons.lang.jar.JarDuplicateFinder

public final class JarDuplicateFinder extends Object
Utility class for finding multiple instances of the same Jar that exists either in different folder or the same, with the same name and version, or same name but different versions. This class will consider Jar as being duplicates based on their base name, not their content or any other indicator.

Since:
  1.10.0

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static List<JarDuplicates>`
  `findJarDuplicates(@NonNull File... jarPaths)`
  Finds all jar duplicates.
  `static List<JarDuplicates>`
  `findJarDuplicates(@NonNull String... jarPaths)`
  Finds all jar duplicates.
  `static List<JarDuplicates>`
  `findJarDuplicates(@NonNull Collection<? extends File> jarPaths)`
  Finds all jar duplicates.
  `static List<JarFile>`
  `findJarDuplicatesOf(@NonNull File jarFile, @NonNull List<File> paths)`
  Finds duplicates of a specific jar file, without returning that jar itself.
  `static void`
  `main(String[] args)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### findJarDuplicates

    public static List<JarDuplicates> findJarDuplicates(@NonNull @NonNull Collection<? extends File> jarPaths)
    Finds all jar duplicates. Supplied paths can be any combination of jar files or directory of jar files. A jar file is any file with the ".jar" extension. Files with different extensions are ignored.
    Parameters:
      `jarPaths` - paths to either jar files or directories containing jars
    Returns:
      list of jar duplicates, or an empty list when no duplicate Jars are found, never `null`.
    Since:
      3.0.0

  - ### findJarDuplicates

    public static List<JarDuplicates> findJarDuplicates(@NonNull @NonNull String... jarPaths)
    Finds all jar duplicates. Supplied paths can be any combination of jar files or directory of jar files. A jar file is any file with the ".jar" extension. Files with different extensions are ignored.
    Parameters:
      `jarPaths` - paths to either jar files or directories containing jars
    Returns:
      list of jar duplicates, or an empty list when no duplicate Jars are found, never `null`.

  - ### findJarDuplicates

    public static List<JarDuplicates> findJarDuplicates(@NonNull @NonNull File... jarPaths)
    Finds all jar duplicates. Supplied paths can be any combination of jar files or directory of jar files. A jar file is any file with the ".jar" extension. Files with different extensions are ignored.
    Parameters:
      `jarPaths` - paths to either jar files or directories containing jars
    Returns:
      list of jar duplicates, or an empty list when no duplicate Jars are found, never `null`.

  - ### findJarDuplicatesOf

    public static List<JarFile> findJarDuplicatesOf(@NonNull @NonNull File jarFile, @NonNull @NonNull List<File> paths)
    Finds duplicates of a specific jar file, without returning that jar itself. Supplied target paths can be any combination of jar files or directory of jar files. A jar file is any file with the ".jar" extension. Files with different extensions are ignored.
    Parameters:
      `jarFile` - the Jar file being compared
      `paths` - paths to potential duplicate jar files or directories containing jar files
    Returns:
      jar file duplicates, sorted from greatest to lowest, or an empty list when no duplicate Jars are found, never `null`
    Since:
      3.0.0

  - ### main

    public static void main(String[] args)