Java Code Examples for java.awt.datatransfer.DataFlavor#hashCode()

The following examples show how to use java.awt.datatransfer.DataFlavor#hashCode() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EqualsHashCodeSymmetryTest.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void testEqualsHashCodeConsistency() {
    for (DataFlavor flavor1 : dataFlavors) {
        for (DataFlavor flavor2 : dataFlavors) {
            if ((flavor1.equals(flavor2) && flavor1.hashCode() != flavor2.hashCode())) {
                throw new RuntimeException(
                        String.format("Equals and hash code not consistent for %s and %s", flavor1, flavor2));
            }
        }
    }
}
 
Example 2
Source File: EqualsHashCodeSymmetryTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static void testEqualsHashCodeConsistency() {
    for (DataFlavor flavor1 : dataFlavors) {
        for (DataFlavor flavor2 : dataFlavors) {
            if ((flavor1.equals(flavor2) && flavor1.hashCode() != flavor2.hashCode())) {
                throw new RuntimeException(
                        String.format("Equals and hash code not consistent for %s and %s", flavor1, flavor2));
            }
        }
    }
}
 
Example 3
Source File: EqualsHashCodeSymmetryTest.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private static void testEqualsHashCodeConsistency() {
    for (DataFlavor flavor1 : dataFlavors) {
        for (DataFlavor flavor2 : dataFlavors) {
            if ((flavor1.equals(flavor2) && flavor1.hashCode() != flavor2.hashCode())) {
                throw new RuntimeException(
                        String.format("Equals and hash code not consistent for %s and %s", flavor1, flavor2));
            }
        }
    }
}
 
Example 4
Source File: EqualsHashCodeSymmetryTest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static void testEqualsHashCodeConsistency() {
    for (DataFlavor flavor1 : dataFlavors) {
        for (DataFlavor flavor2 : dataFlavors) {
            if ((flavor1.equals(flavor2) && flavor1.hashCode() != flavor2.hashCode())) {
                throw new RuntimeException(
                        String.format("Equals and hash code not consistent for %s and %s", flavor1, flavor2));
            }
        }
    }
}
 
Example 5
Source File: EqualsHashCodeSymmetryTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static void testEqualsHashCodeConsistency() {
    for (DataFlavor flavor1 : dataFlavors) {
        for (DataFlavor flavor2 : dataFlavors) {
            if ((flavor1.equals(flavor2) && flavor1.hashCode() != flavor2.hashCode())) {
                throw new RuntimeException(
                        String.format("Equals and hash code not consistent for %s and %s", flavor1, flavor2));
            }
        }
    }
}
 
Example 6
Source File: EqualHashCodeTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    boolean passed = true;
    try {
        df1 = new DataFlavor( "application/postscript" );
        df2 = new DataFlavor( "application/*" );
    } catch (ClassNotFoundException e1) {
        throw new RuntimeException("Could not create DataFlavors. This should never happen.");
    } catch (IllegalArgumentException e2) {
        passed = false;
    }
    if (df1.hashCode() != df2.hashCode()) {
        passed = false;
    }
    dim1 = new Dimension(3, 18);
    dim2 = new Dimension(3, 18);
    if (dim1.hashCode() != dim2.hashCode()) {
        passed = false;
    }
    insets1 = new Insets(3, 4, 7, 11);
    insets2 = new Insets(3, 4, 7, 11);
    if (insets1.hashCode() != insets2.hashCode()) {
        passed = false;
    }
    cm1 = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB),
                                  ColorModelBits, true, true,
                                  Transparency.OPAQUE, 0);
    cm2 = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB),
                                  ColorModelBits, true, true,
                                  Transparency.OPAQUE, 0);
    if (cm1.hashCode() != cm2.hashCode()) {
        passed = false;
    }
    if (!passed)
        throw new RuntimeException("Test FAILED");
}
 
Example 7
Source File: EqualsHashCodeSymmetryTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static void testEqualsHashCodeConsistency() {
    for (DataFlavor flavor1 : dataFlavors) {
        for (DataFlavor flavor2 : dataFlavors) {
            if ((flavor1.equals(flavor2) && flavor1.hashCode() != flavor2.hashCode())) {
                throw new RuntimeException(
                        String.format("Equals and hash code not consistent for %s and %s", flavor1, flavor2));
            }
        }
    }
}
 
Example 8
Source File: EqualsHashCodeSymmetryTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void testEqualsHashCodeConsistency() {
    for (DataFlavor flavor1 : dataFlavors) {
        for (DataFlavor flavor2 : dataFlavors) {
            if ((flavor1.equals(flavor2) && flavor1.hashCode() != flavor2.hashCode())) {
                throw new RuntimeException(
                        String.format("Equals and hash code not consistent for %s and %s", flavor1, flavor2));
            }
        }
    }
}
 
Example 9
Source File: EqualsHashCodeSymmetryTest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static void testEqualsHashCodeConsistency() {
    for (DataFlavor flavor1 : dataFlavors) {
        for (DataFlavor flavor2 : dataFlavors) {
            if ((flavor1.equals(flavor2) && flavor1.hashCode() != flavor2.hashCode())) {
                throw new RuntimeException(
                        String.format("Equals and hash code not consistent for %s and %s", flavor1, flavor2));
            }
        }
    }
}
 
Example 10
Source File: EqualsHashCodeSymmetryTest.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void testEqualsHashCodeConsistency() {
    for (DataFlavor flavor1 : dataFlavors) {
        for (DataFlavor flavor2 : dataFlavors) {
            if ((flavor1.equals(flavor2) && flavor1.hashCode() != flavor2.hashCode())) {
                throw new RuntimeException(
                        String.format("Equals and hash code not consistent for %s and %s", flavor1, flavor2));
            }
        }
    }
}
 
Example 11
Source File: EqualsHashCodeSymmetryTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void testEqualsHashCodeConsistency() {
    for (DataFlavor flavor1 : dataFlavors) {
        for (DataFlavor flavor2 : dataFlavors) {
            if ((flavor1.equals(flavor2) && flavor1.hashCode() != flavor2.hashCode())) {
                throw new RuntimeException(
                        String.format("Equals and hash code not consistent for %s and %s", flavor1, flavor2));
            }
        }
    }
}
 
Example 12
Source File: EqualsHashCodeSymmetryTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void testEqualsHashCodeConsistency() {
    for (DataFlavor flavor1 : dataFlavors) {
        for (DataFlavor flavor2 : dataFlavors) {
            if ((flavor1.equals(flavor2) && flavor1.hashCode() != flavor2.hashCode())) {
                throw new RuntimeException(
                        String.format("Equals and hash code not consistent for %s and %s", flavor1, flavor2));
            }
        }
    }
}