Java Code Examples for sun.text.IntHashtable#equals()
The following examples show how to use
sun.text.IntHashtable#equals() .
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: Bug4170614Test.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
public static void testIntHashtable() throws Exception { IntHashtable fred = new IntHashtable(); fred.put(1, 10); fred.put(2, 20); fred.put(3, 30); IntHashtable barney = new IntHashtable(); barney.put(1, 10); barney.put(3, 30); barney.put(2, 20); IntHashtable homer = new IntHashtable(); homer.put(3, 30); homer.put(1, 10); homer.put(7, 900); if (fred.equals(barney)) { System.out.println("fred.equals(barney)"); } else { System.out.println("!fred.equals(barney)"); } System.out.println("fred.hashCode() == " + fred.hashCode()); System.out.println("barney.hashCode() == " + barney.hashCode()); if (!fred.equals(barney)) { throw new Exception("equals() failed on two hashtables that are equal"); } if (fred.hashCode() != barney.hashCode()) { throw new Exception("hashCode() failed on two hashtables that are equal"); } System.out.println(); if (fred.equals(homer)) { System.out.println("fred.equals(homer)"); } else { System.out.println("!fred.equals(homer)"); } System.out.println("fred.hashCode() == " + fred.hashCode()); System.out.println("homer.hashCode() == " + homer.hashCode()); if (fred.equals(homer)) { throw new Exception("equals() failed on two hashtables that are not equal"); } if (fred.hashCode() == homer.hashCode()) { throw new Exception("hashCode() failed on two hashtables that are not equal"); } System.out.println(); System.out.println("testIntHashtable() passed.\n"); }
Example 2
Source File: Bug4170614Test.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public static void testIntHashtable() throws Exception { IntHashtable fred = new IntHashtable(); fred.put(1, 10); fred.put(2, 20); fred.put(3, 30); IntHashtable barney = new IntHashtable(); barney.put(1, 10); barney.put(3, 30); barney.put(2, 20); IntHashtable homer = new IntHashtable(); homer.put(3, 30); homer.put(1, 10); homer.put(7, 900); if (fred.equals(barney)) { System.out.println("fred.equals(barney)"); } else { System.out.println("!fred.equals(barney)"); } System.out.println("fred.hashCode() == " + fred.hashCode()); System.out.println("barney.hashCode() == " + barney.hashCode()); if (!fred.equals(barney)) { throw new Exception("equals() failed on two hashtables that are equal"); } if (fred.hashCode() != barney.hashCode()) { throw new Exception("hashCode() failed on two hashtables that are equal"); } System.out.println(); if (fred.equals(homer)) { System.out.println("fred.equals(homer)"); } else { System.out.println("!fred.equals(homer)"); } System.out.println("fred.hashCode() == " + fred.hashCode()); System.out.println("homer.hashCode() == " + homer.hashCode()); if (fred.equals(homer)) { throw new Exception("equals() failed on two hashtables that are not equal"); } if (fred.hashCode() == homer.hashCode()) { throw new Exception("hashCode() failed on two hashtables that are not equal"); } System.out.println(); System.out.println("testIntHashtable() passed.\n"); }
Example 3
Source File: Bug4170614Test.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public static void testIntHashtable() throws Exception { IntHashtable fred = new IntHashtable(); fred.put(1, 10); fred.put(2, 20); fred.put(3, 30); IntHashtable barney = new IntHashtable(); barney.put(1, 10); barney.put(3, 30); barney.put(2, 20); IntHashtable homer = new IntHashtable(); homer.put(3, 30); homer.put(1, 10); homer.put(7, 900); if (fred.equals(barney)) { System.out.println("fred.equals(barney)"); } else { System.out.println("!fred.equals(barney)"); } System.out.println("fred.hashCode() == " + fred.hashCode()); System.out.println("barney.hashCode() == " + barney.hashCode()); if (!fred.equals(barney)) { throw new Exception("equals() failed on two hashtables that are equal"); } if (fred.hashCode() != barney.hashCode()) { throw new Exception("hashCode() failed on two hashtables that are equal"); } System.out.println(); if (fred.equals(homer)) { System.out.println("fred.equals(homer)"); } else { System.out.println("!fred.equals(homer)"); } System.out.println("fred.hashCode() == " + fred.hashCode()); System.out.println("homer.hashCode() == " + homer.hashCode()); if (fred.equals(homer)) { throw new Exception("equals() failed on two hashtables that are not equal"); } if (fred.hashCode() == homer.hashCode()) { throw new Exception("hashCode() failed on two hashtables that are not equal"); } System.out.println(); System.out.println("testIntHashtable() passed.\n"); }
Example 4
Source File: Bug4170614Test.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public static void testIntHashtable() throws Exception { IntHashtable fred = new IntHashtable(); fred.put(1, 10); fred.put(2, 20); fred.put(3, 30); IntHashtable barney = new IntHashtable(); barney.put(1, 10); barney.put(3, 30); barney.put(2, 20); IntHashtable homer = new IntHashtable(); homer.put(3, 30); homer.put(1, 10); homer.put(7, 900); if (fred.equals(barney)) { System.out.println("fred.equals(barney)"); } else { System.out.println("!fred.equals(barney)"); } System.out.println("fred.hashCode() == " + fred.hashCode()); System.out.println("barney.hashCode() == " + barney.hashCode()); if (!fred.equals(barney)) { throw new Exception("equals() failed on two hashtables that are equal"); } if (fred.hashCode() != barney.hashCode()) { throw new Exception("hashCode() failed on two hashtables that are equal"); } System.out.println(); if (fred.equals(homer)) { System.out.println("fred.equals(homer)"); } else { System.out.println("!fred.equals(homer)"); } System.out.println("fred.hashCode() == " + fred.hashCode()); System.out.println("homer.hashCode() == " + homer.hashCode()); if (fred.equals(homer)) { throw new Exception("equals() failed on two hashtables that are not equal"); } if (fred.hashCode() == homer.hashCode()) { throw new Exception("hashCode() failed on two hashtables that are not equal"); } System.out.println(); System.out.println("testIntHashtable() passed.\n"); }
Example 5
Source File: Bug4170614Test.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
public static void testIntHashtable() throws Exception { IntHashtable fred = new IntHashtable(); fred.put(1, 10); fred.put(2, 20); fred.put(3, 30); IntHashtable barney = new IntHashtable(); barney.put(1, 10); barney.put(3, 30); barney.put(2, 20); IntHashtable homer = new IntHashtable(); homer.put(3, 30); homer.put(1, 10); homer.put(7, 900); if (fred.equals(barney)) { System.out.println("fred.equals(barney)"); } else { System.out.println("!fred.equals(barney)"); } System.out.println("fred.hashCode() == " + fred.hashCode()); System.out.println("barney.hashCode() == " + barney.hashCode()); if (!fred.equals(barney)) { throw new Exception("equals() failed on two hashtables that are equal"); } if (fred.hashCode() != barney.hashCode()) { throw new Exception("hashCode() failed on two hashtables that are equal"); } System.out.println(); if (fred.equals(homer)) { System.out.println("fred.equals(homer)"); } else { System.out.println("!fred.equals(homer)"); } System.out.println("fred.hashCode() == " + fred.hashCode()); System.out.println("homer.hashCode() == " + homer.hashCode()); if (fred.equals(homer)) { throw new Exception("equals() failed on two hashtables that are not equal"); } if (fred.hashCode() == homer.hashCode()) { throw new Exception("hashCode() failed on two hashtables that are not equal"); } System.out.println(); System.out.println("testIntHashtable() passed.\n"); }