Tabnine Logo
File.compareTo
Code IndexAdd Tabnine to your IDE (free)

How to use
compareTo
method
in
java.io.File

Best Java code snippets using java.io.File.compareTo (Showing top 20 results out of 1,098)

origin: commons-io/commons-io

  /**
   * Compare the two files using the {@link File#compareTo(File)} method.
   *
   * @param file1 The first file to compare
   * @param file2 The second file to compare
   * @return the result of calling file1's
   * {@link File#compareTo(File)} with file2 as the parameter.
   */
  @Override
  public int compare(final File file1, final File file2) {
    return file1.compareTo(file2);
  }
}
origin: joelittlejohn/jsonschema2pojo

  @Override
  public Comparator<File> getComparator() {
    return (a, b) -> a.compareTo(b);
  }
},
origin: sleekbyte/tailor

@Override
public int compareTo(Printer printer) {
  return this.inputFile.compareTo(printer.inputFile);
}
origin: docker-java/docker-java

private boolean isBaseDirectory(File directory) {
  return directory.compareTo(baseDirectory) == 0;
}
origin: apache/incubator-druid

 @Override
 public int compare(File o1, File o2)
 {
  try {
   return Ints.compare(Integer.parseInt(o1.getName()), Integer.parseInt(o2.getName()));
  }
  catch (NumberFormatException e) {
   log.error(e, "Couldn't compare as numbers? [%s][%s]", o1, o2);
   return o1.compareTo(o2);
  }
 }
}
origin: plantuml/plantuml

public int compareTo(GeneratedImage this2) {
  final int cmp = this.pngFile.compareTo(this2.getPngFile());
  if (cmp != 0) {
    return cmp;
  }
  return this.description.compareTo(this2.getDescription());
}
origin: jeremylong/DependencyCheck

File mpp = new File(project.getBasedir(), m);
mpp = mpp.getCanonicalFile();
if (mpp.compareTo(mod.getBasedir()) == 0 && descendants.add(mod)
    && getLog().isDebugEnabled()) {
  getLog().debug(String.format("Descendant module %s added", mod.getName()));
    File mpp = new File(dec.getBasedir(), mod);
    mpp = mpp.getCanonicalFile();
    if (mpp.compareTo(p.getBasedir()) == 0) {
      addedDescendants.add(p);
origin: voldemort/voldemort

                 + " does not exist.");
if(!(newVersionDir.getParentFile().compareTo(storeDir.getAbsoluteFile()) == 0 && ReadOnlyUtils.checkVersionDirName(newVersionDir)))
  throw new VoldemortException("Invalid version folder name '"
                 + newVersionDir
origin: facebook/facebook-android-sdk

@Override
public int compareTo(ModifiedFile another) {
  if (getModified() < another.getModified()) {
    return -1;
  } else if (getModified() > another.getModified()) {
    return 1;
  } else {
    return getFile().compareTo(another.getFile());
  }
}
origin: jphp-group/jphp

@Signature(@Arg("file"))
public Memory compareTo(Environment env, Memory... args){
  File what;
  if (args[0].isObject()){
    if (args[0].instanceOf("php\\io\\File")){
      FileObject fileObject = (FileObject)args[0].toValue(ObjectMemory.class).value;
      what = fileObject.file;
    } else {
      exception(env, "Argument 1 must be an instance of %s", "php\\io\\File");
      return Memory.FALSE;
    }
  } else {
    what = new File(args[0].toString());
  }
  return LongMemory.valueOf(file.compareTo(what));
}
origin: org.apache.ant/ant

/**
 * Compare this FileResource to another Resource.
 * @param another the other Resource against which to compare.
 * @return a negative integer, zero, or a positive integer as this FileResource
 *         is less than, equal to, or greater than the specified Resource.
 */
@Override
public int compareTo(Resource another) {
  if (isReference()) {
    return getCheckedRef().compareTo(another);
  }
  if (this.equals(another)) {
    return 0;
  }
  FileProvider otherFP = another.as(FileProvider.class);
  if (otherFP != null) {
    File f = getFile();
    if (f == null) {
      return -1;
    }
    File of = otherFP.getFile();
    if (of == null) {
      return 1;
    }
    int compareFiles = f.compareTo(of);
    return compareFiles != 0 ? compareFiles
      : getName().compareTo(another.getName());
  }
  return super.compareTo(another);
}
origin: org.apache.hadoop/hadoop-hdfs

/**
 * Verify whether the actual directory location of block file has the
 * expected directory path computed using its block ID.
 */
private void verifyFileLocation(File actualBlockFile,
  File bpFinalizedDir, long blockId) {
 File expectedBlockDir =
   DatanodeUtil.idToBlockDir(bpFinalizedDir, blockId);
 File actualBlockDir = actualBlockFile.getParentFile();
 if (actualBlockDir.compareTo(expectedBlockDir) != 0) {
  LOG.warn("Block: " + blockId +
    " found in invalid directory.  Expected directory: " +
    expectedBlockDir + ".  Actual directory: " + actualBlockDir);
 }
}
origin: geotools/geotools

/** Just groups together files that have the same ShpFiles instance */
public int compareTo(StorageFile o) {
  // group togheter files that have the same shpefile instance
  if (this == o) {
    return 0;
  }
  // assume two StorageFile that do not share the same ShpFiles
  // are not given the same temp file
  return getFile().compareTo(o.getFile());
}
origin: org.apache.hadoop/hadoop-hdfs

@Override
public int compareWith(ScanInfo info) {
 return info.getBlockFile().compareTo(getBlockFile());
}
origin: spring-projects/spring-roo

public int compareTo(final FileDetails o) {
 if (o == null) {
  throw new NullPointerException();
 }
 // N.B. this is in reverse order to how we'd normally compare
 int result = o.getFile().compareTo(file);
 if (result == 0) {
  result = ObjectUtils.compare(o.getLastModified(), lastModified);
 }
 return result;
}
origin: pippo-java/pippo

@Override
public int compare(DirEntry o1, DirEntry o2) {
  if (o1.isDirectory() && !o2.isDirectory()) {
    return -1;
  }
  if (!o1.isDirectory() && o2.isDirectory()) {
    return 1;
  }
  return o1.file.compareTo(o2.file);
}
origin: Hive2Hive/Hive2Hive

  @Override
  public int compare(File file1, File file2) {
    return file1.compareTo(file2);
  }
});
origin: org.tmatesoft.svnkit/svnkit

public int compareTo(Object obj) {
  if (obj == null || obj.getClass() != MergePath.class) {
    return -1;
  }
  MergePath mergePath = (MergePath) obj; 
  if (this == mergePath) {
    return 0;
  }
  return myPath.compareTo(mergePath.myPath);
}

origin: org.apache.hadoop/hadoop-hdfs

if (!diskMetaFileExists) {
 LOG.warn(warningPrefix + "null");
} else if (memMetaFile.compareTo(diskMetaFile) != 0) {
 LOG.warn(warningPrefix + diskMetaFile.getAbsolutePath());
origin: freenet/fred

@Override
public int compareTo(Dependency arg0) {
  if(this == arg0) return 0;
  if(order > arg0.order) return 1;
  else if(order < arg0.order) return -1;
  // Filename comparisons aren't very reliable (e.g. "./test" versus "test" are not equals()!), go by getName() first.
  int ret = newFilename.getName().compareTo(arg0.newFilename.getName());
  if(ret != 0) return ret;
  return newFilename.compareTo(arg0.newFilename);
}
java.ioFilecompareTo

Javadoc

Returns the relative sort ordering of the paths for this file and the file another. The ordering is platform dependent.

Popular methods of File

  • <init>
    Creates a new File instance by converting the givenfile: URI into an abstract pathname. The exact fo
  • exists
    Tests whether the file or directory denoted by this abstract pathname exists.
  • getAbsolutePath
    Returns the absolute pathname string of this abstract pathname. If this abstract pathname is already
  • getName
    Returns the name of the file or directory denoted by this abstract pathname. This is just the last n
  • isDirectory
  • mkdirs
  • delete
    Deletes the file or directory denoted by this abstract pathname. If this pathname denotes a director
  • listFiles
    Returns an array of abstract pathnames denoting the files and directories in the directory denoted b
  • getParentFile
    Returns the abstract pathname of this abstract pathname's parent, or null if this pathname does not
  • getPath
    Converts this abstract pathname into a pathname string. The resulting string uses the #separator to
  • isFile
  • length
    Returns the length of the file denoted by this abstract pathname. The return value is unspecified if
  • isFile,
  • length,
  • toURI,
  • createTempFile,
  • createNewFile,
  • toPath,
  • mkdir,
  • lastModified,
  • toString,
  • getCanonicalPath

Popular in Java

  • Start an intent from android
  • scheduleAtFixedRate (Timer)
  • runOnUiThread (Activity)
  • getSharedPreferences (Context)
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • BoxLayout (javax.swing)
  • JButton (javax.swing)
  • JCheckBox (javax.swing)
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now