java.io.File#hashCode ( )源码实例Demo

下面列出了java.io.File#hashCode ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。


/**
 * Returns a hash code value for this {@code Redirect}.
 * @return a hash code value for this {@code Redirect}
 */
public int hashCode() {
    File file = file();
    if (file == null)
        return super.hashCode();
    else
        return file.hashCode();
}
 
源代码2 项目: hottub   文件: HashCodeEquals.java

static void test(String fn1, String fn2) throws Exception {
    File f1 = new File(fn1);
    File f2 = new File(fn2);
    if (!f1.equals(f2))
        throw new Exception("Instances with equal paths are not equal");
    int h1 = f1.hashCode();
    int h2 = f2.hashCode();
    if (h1 != h2)
        throw new Exception("Hashcodes of equal instances are not equal");
}
 
源代码3 项目: openjdk-8   文件: HashCodeEquals.java

static void test(String fn1, String fn2) throws Exception {
    File f1 = new File(fn1);
    File f2 = new File(fn2);
    if (!f1.equals(f2))
        throw new Exception("Instances with equal paths are not equal");
    int h1 = f1.hashCode();
    int h2 = f2.hashCode();
    if (h1 != h2)
        throw new Exception("Hashcodes of equal instances are not equal");
}
 
源代码4 项目: TencentKona-8   文件: HashCodeEquals.java

static void test(String fn1, String fn2) throws Exception {
    File f1 = new File(fn1);
    File f2 = new File(fn2);
    if (!f1.equals(f2))
        throw new Exception("Instances with equal paths are not equal");
    int h1 = f1.hashCode();
    int h2 = f2.hashCode();
    if (h1 != h2)
        throw new Exception("Hashcodes of equal instances are not equal");
}
 
源代码5 项目: jdk8u60   文件: ProcessBuilder.java

/**
 * Returns a hash code value for this {@code Redirect}.
 * @return a hash code value for this {@code Redirect}
 */
public int hashCode() {
    File file = file();
    if (file == null)
        return super.hashCode();
    else
        return file.hashCode();
}
 
源代码6 项目: jdk8u60   文件: HashCodeEquals.java

static void test(String fn1, String fn2) throws Exception {
    File f1 = new File(fn1);
    File f2 = new File(fn2);
    if (!f1.equals(f2))
        throw new Exception("Instances with equal paths are not equal");
    int h1 = f1.hashCode();
    int h2 = f2.hashCode();
    if (h1 != h2)
        throw new Exception("Hashcodes of equal instances are not equal");
}
 
源代码7 项目: jdk8u-jdk   文件: HashCodeEquals.java

static void test(String fn1, String fn2) throws Exception {
    File f1 = new File(fn1);
    File f2 = new File(fn2);
    if (!f1.equals(f2))
        throw new Exception("Instances with equal paths are not equal");
    int h1 = f1.hashCode();
    int h2 = f2.hashCode();
    if (h1 != h2)
        throw new Exception("Hashcodes of equal instances are not equal");
}
 
源代码8 项目: openjdk-jdk8u   文件: HashCodeEquals.java

static void test(String fn1, String fn2) throws Exception {
    File f1 = new File(fn1);
    File f2 = new File(fn2);
    if (!f1.equals(f2))
        throw new Exception("Instances with equal paths are not equal");
    int h1 = f1.hashCode();
    int h2 = f2.hashCode();
    if (h1 != h2)
        throw new Exception("Hashcodes of equal instances are not equal");
}
 
源代码9 项目: openjdk-8   文件: ProcessBuilder.java

/**
 * Returns a hash code value for this {@code Redirect}.
 * @return a hash code value for this {@code Redirect}
 */
public int hashCode() {
    File file = file();
    if (file == null)
        return super.hashCode();
    else
        return file.hashCode();
}
 
源代码10 项目: jdk8u_jdk   文件: HashCodeEquals.java

static void test(String fn1, String fn2) throws Exception {
    File f1 = new File(fn1);
    File f2 = new File(fn2);
    if (!f1.equals(f2))
        throw new Exception("Instances with equal paths are not equal");
    int h1 = f1.hashCode();
    int h2 = f2.hashCode();
    if (h1 != h2)
        throw new Exception("Hashcodes of equal instances are not equal");
}
 

/**
 * Returns a hash code value for this {@code Redirect}.
 * @return a hash code value for this {@code Redirect}
 */
public int hashCode() {
    File file = file();
    if (file == null)
        return super.hashCode();
    else
        return file.hashCode();
}
 

static void test(String fn1, String fn2) throws Exception {
    File f1 = new File(fn1);
    File f2 = new File(fn2);
    if (!f1.equals(f2))
        throw new Exception("Instances with equal paths are not equal");
    int h1 = f1.hashCode();
    int h2 = f2.hashCode();
    if (h1 != h2)
        throw new Exception("Hashcodes of equal instances are not equal");
}
 
源代码13 项目: openjdk-jdk9   文件: HashCodeEquals.java

static void test(String fn1, String fn2) throws Exception {
    File f1 = new File(fn1);
    File f2 = new File(fn2);
    if (!f1.equals(f2))
        throw new Exception("Instances with equal paths are not equal");
    int h1 = f1.hashCode();
    int h2 = f2.hashCode();
    if (h1 != h2)
        throw new Exception("Hashcodes of equal instances are not equal");
}
 
源代码14 项目: Fishing   文件: ImageModel.java

private String createName(File file){
    String realName = "u"+UID+System.currentTimeMillis()+file.hashCode()+".jpg";
    return realName;
}
 
源代码15 项目: BiglyBT   文件: StringInterner.java

public WeakFileEntry(File entry)
{
	// file object with 2 fields, string object with 2 fields, char-array object
	super(entry, entry.hashCode(), 16 + 16 + 8 + entry.getPath().length() * 2);
}
 

private static Object getFileLock(final File file) {
    return locks[(file.hashCode() & Integer.MAX_VALUE) % locks.length];
}
 

private static Object getFileLock(final File file) {
    return locks[(file.hashCode() & Integer.MAX_VALUE) % locks.length];
}
 
源代码18 项目: hottub   文件: OptimisticTypesPersistence.java

private static Object getFileLock(final File file) {
    return locks[(file.hashCode() & Integer.MAX_VALUE) % locks.length];
}
 

private static Object getFileLock(final File file) {
    return locks[(file.hashCode() & Integer.MAX_VALUE) % locks.length];
}
 

private static Object getFileLock(final File file) {
    return locks[(file.hashCode() & Integer.MAX_VALUE) % locks.length];
}