Java Code Examples for java.util.Hashtable#equals()
The following examples show how to use
java.util.Hashtable#equals() .
These examples are extracted from open source projects.
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 Project: dragonwell8_jdk File: SimpleSerialization.java License: GNU General Public License v2.0 | 5 votes |
public static void main(final String[] args) throws Exception { Hashtable<String, String> h1 = new Hashtable<>(); System.err.println("*** BEGIN TEST ***"); h1.put("key", "value"); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); try (ObjectOutputStream oos = new ObjectOutputStream(baos)) { oos.writeObject(h1); } final byte[] data = baos.toByteArray(); final ByteArrayInputStream bais = new ByteArrayInputStream(data); final Object deserializedObject; try (ObjectInputStream ois = new ObjectInputStream(bais)) { deserializedObject = ois.readObject(); } if(!h1.getClass().isInstance(deserializedObject)) { throw new RuntimeException("Result not assignable to type of h1"); } if (false == h1.equals(deserializedObject)) { Hashtable<String, String> d1 = (Hashtable<String, String>) h1; for(Map.Entry entry: h1.entrySet()) { System.err.println("h1.key::" + entry.getKey() + " d1.containsKey()::" + d1.containsKey((String) entry.getKey())); System.err.println("h1.value::" + entry.getValue() + " d1.contains()::" + d1.contains(entry.getValue())); System.err.println("h1.value == d1.value " + entry.getValue().equals(d1.get((String) entry.getKey()))); } throw new RuntimeException(getFailureText(h1, deserializedObject)); } }
Example 2
Source Project: TencentKona-8 File: SimpleSerialization.java License: GNU General Public License v2.0 | 5 votes |
public static void main(final String[] args) throws Exception { Hashtable<String, String> h1 = new Hashtable<>(); System.err.println("*** BEGIN TEST ***"); h1.put("key", "value"); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); try (ObjectOutputStream oos = new ObjectOutputStream(baos)) { oos.writeObject(h1); } final byte[] data = baos.toByteArray(); final ByteArrayInputStream bais = new ByteArrayInputStream(data); final Object deserializedObject; try (ObjectInputStream ois = new ObjectInputStream(bais)) { deserializedObject = ois.readObject(); } if(!h1.getClass().isInstance(deserializedObject)) { throw new RuntimeException("Result not assignable to type of h1"); } if (false == h1.equals(deserializedObject)) { Hashtable<String, String> d1 = (Hashtable<String, String>) h1; for(Map.Entry entry: h1.entrySet()) { System.err.println("h1.key::" + entry.getKey() + " d1.containsKey()::" + d1.containsKey((String) entry.getKey())); System.err.println("h1.value::" + entry.getValue() + " d1.contains()::" + d1.contains(entry.getValue())); System.err.println("h1.value == d1.value " + entry.getValue().equals(d1.get((String) entry.getKey()))); } throw new RuntimeException(getFailureText(h1, deserializedObject)); } }
Example 3
Source Project: native-obfuscator File: SimpleSerialization.java License: GNU General Public License v3.0 | 5 votes |
public static void main(final String[] args) throws Exception { Hashtable<String, String> h1 = new Hashtable<>(); System.err.println("*** BEGIN TEST ***"); h1.put("key", "value"); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); try (ObjectOutputStream oos = new ObjectOutputStream(baos)) { oos.writeObject(h1); } final byte[] data = baos.toByteArray(); final ByteArrayInputStream bais = new ByteArrayInputStream(data); final Object deserializedObject; try (ObjectInputStream ois = new ObjectInputStream(bais)) { deserializedObject = ois.readObject(); } if(!h1.getClass().isInstance(deserializedObject)) { throw new RuntimeException("Result not assignable to type of h1"); } if (false == h1.equals(deserializedObject)) { Hashtable<String, String> d1 = (Hashtable<String, String>) h1; for(Map.Entry entry: h1.entrySet()) { System.err.println("h1.key::" + entry.getKey() + " d1.containsKey()::" + d1.containsKey((String) entry.getKey())); System.err.println("h1.value::" + entry.getValue() + " d1.contains()::" + d1.contains(entry.getValue())); System.err.println("h1.value == d1.value " + entry.getValue().equals(d1.get((String) entry.getKey()))); } throw new RuntimeException(getFailureText(h1, deserializedObject)); } }
Example 4
Source Project: jdk8u60 File: SimpleSerialization.java License: GNU General Public License v2.0 | 5 votes |
public static void main(final String[] args) throws Exception { Hashtable<String, String> h1 = new Hashtable<>(); System.err.println("*** BEGIN TEST ***"); h1.put("key", "value"); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); try (ObjectOutputStream oos = new ObjectOutputStream(baos)) { oos.writeObject(h1); } final byte[] data = baos.toByteArray(); final ByteArrayInputStream bais = new ByteArrayInputStream(data); final Object deserializedObject; try (ObjectInputStream ois = new ObjectInputStream(bais)) { deserializedObject = ois.readObject(); } if(!h1.getClass().isInstance(deserializedObject)) { throw new RuntimeException("Result not assignable to type of h1"); } if (false == h1.equals(deserializedObject)) { Hashtable<String, String> d1 = (Hashtable<String, String>) h1; for(Map.Entry entry: h1.entrySet()) { System.err.println("h1.key::" + entry.getKey() + " d1.containsKey()::" + d1.containsKey((String) entry.getKey())); System.err.println("h1.value::" + entry.getValue() + " d1.contains()::" + d1.contains(entry.getValue())); System.err.println("h1.value == d1.value " + entry.getValue().equals(d1.get((String) entry.getKey()))); } throw new RuntimeException(getFailureText(h1, deserializedObject)); } }
Example 5
Source Project: openjdk-jdk8u File: SimpleSerialization.java License: GNU General Public License v2.0 | 5 votes |
public static void main(final String[] args) throws Exception { Hashtable<String, String> h1 = new Hashtable<>(); System.err.println("*** BEGIN TEST ***"); h1.put("key", "value"); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); try (ObjectOutputStream oos = new ObjectOutputStream(baos)) { oos.writeObject(h1); } final byte[] data = baos.toByteArray(); final ByteArrayInputStream bais = new ByteArrayInputStream(data); final Object deserializedObject; try (ObjectInputStream ois = new ObjectInputStream(bais)) { deserializedObject = ois.readObject(); } if(!h1.getClass().isInstance(deserializedObject)) { throw new RuntimeException("Result not assignable to type of h1"); } if (false == h1.equals(deserializedObject)) { Hashtable<String, String> d1 = (Hashtable<String, String>) h1; for(Map.Entry entry: h1.entrySet()) { System.err.println("h1.key::" + entry.getKey() + " d1.containsKey()::" + d1.containsKey((String) entry.getKey())); System.err.println("h1.value::" + entry.getValue() + " d1.contains()::" + d1.contains(entry.getValue())); System.err.println("h1.value == d1.value " + entry.getValue().equals(d1.get((String) entry.getKey()))); } throw new RuntimeException(getFailureText(h1, deserializedObject)); } }
Example 6
Source Project: openjdk-jdk8u-backup File: SimpleSerialization.java License: GNU General Public License v2.0 | 5 votes |
public static void main(final String[] args) throws Exception { Hashtable<String, String> h1 = new Hashtable<>(); System.err.println("*** BEGIN TEST ***"); h1.put("key", "value"); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); try (ObjectOutputStream oos = new ObjectOutputStream(baos)) { oos.writeObject(h1); } final byte[] data = baos.toByteArray(); final ByteArrayInputStream bais = new ByteArrayInputStream(data); final Object deserializedObject; try (ObjectInputStream ois = new ObjectInputStream(bais)) { deserializedObject = ois.readObject(); } if(!h1.getClass().isInstance(deserializedObject)) { throw new RuntimeException("Result not assignable to type of h1"); } if (false == h1.equals(deserializedObject)) { Hashtable<String, String> d1 = (Hashtable<String, String>) h1; for(Map.Entry entry: h1.entrySet()) { System.err.println("h1.key::" + entry.getKey() + " d1.containsKey()::" + d1.containsKey((String) entry.getKey())); System.err.println("h1.value::" + entry.getValue() + " d1.contains()::" + d1.contains(entry.getValue())); System.err.println("h1.value == d1.value " + entry.getValue().equals(d1.get((String) entry.getKey()))); } throw new RuntimeException(getFailureText(h1, deserializedObject)); } }
Example 7
Source Project: openjdk-jdk9 File: SimpleSerialization.java License: GNU General Public License v2.0 | 5 votes |
public static void main(final String[] args) throws Exception { Hashtable<String, String> h1 = new Hashtable<>(); System.err.println("*** BEGIN TEST ***"); h1.put("key", "value"); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); try (ObjectOutputStream oos = new ObjectOutputStream(baos)) { oos.writeObject(h1); } final byte[] data = baos.toByteArray(); final ByteArrayInputStream bais = new ByteArrayInputStream(data); final Object deserializedObject; try (ObjectInputStream ois = new ObjectInputStream(bais)) { deserializedObject = ois.readObject(); } if(!h1.getClass().isInstance(deserializedObject)) { throw new RuntimeException("Result not assignable to type of h1"); } if (false == h1.equals(deserializedObject)) { Hashtable<String, String> d1 = (Hashtable<String, String>) h1; for(Map.Entry entry: h1.entrySet()) { System.err.println("h1.key::" + entry.getKey() + " d1.containsKey()::" + d1.containsKey((String) entry.getKey())); System.err.println("h1.value::" + entry.getValue() + " d1.contains()::" + d1.contains(entry.getValue())); System.err.println("h1.value == d1.value " + entry.getValue().equals(d1.get((String) entry.getKey()))); } throw new RuntimeException(getFailureText(h1, deserializedObject)); } }
Example 8
Source Project: jdk8u-jdk File: SimpleSerialization.java License: GNU General Public License v2.0 | 5 votes |
public static void main(final String[] args) throws Exception { Hashtable<String, String> h1 = new Hashtable<>(); System.err.println("*** BEGIN TEST ***"); h1.put("key", "value"); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); try (ObjectOutputStream oos = new ObjectOutputStream(baos)) { oos.writeObject(h1); } final byte[] data = baos.toByteArray(); final ByteArrayInputStream bais = new ByteArrayInputStream(data); final Object deserializedObject; try (ObjectInputStream ois = new ObjectInputStream(bais)) { deserializedObject = ois.readObject(); } if(!h1.getClass().isInstance(deserializedObject)) { throw new RuntimeException("Result not assignable to type of h1"); } if (false == h1.equals(deserializedObject)) { Hashtable<String, String> d1 = (Hashtable<String, String>) h1; for(Map.Entry entry: h1.entrySet()) { System.err.println("h1.key::" + entry.getKey() + " d1.containsKey()::" + d1.containsKey((String) entry.getKey())); System.err.println("h1.value::" + entry.getValue() + " d1.contains()::" + d1.contains(entry.getValue())); System.err.println("h1.value == d1.value " + entry.getValue().equals(d1.get((String) entry.getKey()))); } throw new RuntimeException(getFailureText(h1, deserializedObject)); } }
Example 9
Source Project: hottub File: SimpleSerialization.java License: GNU General Public License v2.0 | 5 votes |
public static void main(final String[] args) throws Exception { Hashtable<String, String> h1 = new Hashtable<>(); System.err.println("*** BEGIN TEST ***"); h1.put("key", "value"); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); try (ObjectOutputStream oos = new ObjectOutputStream(baos)) { oos.writeObject(h1); } final byte[] data = baos.toByteArray(); final ByteArrayInputStream bais = new ByteArrayInputStream(data); final Object deserializedObject; try (ObjectInputStream ois = new ObjectInputStream(bais)) { deserializedObject = ois.readObject(); } if(!h1.getClass().isInstance(deserializedObject)) { throw new RuntimeException("Result not assignable to type of h1"); } if (false == h1.equals(deserializedObject)) { Hashtable<String, String> d1 = (Hashtable<String, String>) h1; for(Map.Entry entry: h1.entrySet()) { System.err.println("h1.key::" + entry.getKey() + " d1.containsKey()::" + d1.containsKey((String) entry.getKey())); System.err.println("h1.value::" + entry.getValue() + " d1.contains()::" + d1.contains(entry.getValue())); System.err.println("h1.value == d1.value " + entry.getValue().equals(d1.get((String) entry.getKey()))); } throw new RuntimeException(getFailureText(h1, deserializedObject)); } }
Example 10
Source Project: openjdk-8-source File: SimpleSerialization.java License: GNU General Public License v2.0 | 5 votes |
public static void main(final String[] args) throws Exception { Hashtable<String, String> h1 = new Hashtable<>(); System.err.println("*** BEGIN TEST ***"); h1.put("key", "value"); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); try (ObjectOutputStream oos = new ObjectOutputStream(baos)) { oos.writeObject(h1); } final byte[] data = baos.toByteArray(); final ByteArrayInputStream bais = new ByteArrayInputStream(data); final Object deserializedObject; try (ObjectInputStream ois = new ObjectInputStream(bais)) { deserializedObject = ois.readObject(); } if(!h1.getClass().isInstance(deserializedObject)) { throw new RuntimeException("Result not assignable to type of h1"); } if (false == h1.equals(deserializedObject)) { Hashtable<String, String> d1 = (Hashtable<String, String>) h1; for(Map.Entry entry: h1.entrySet()) { System.err.println("h1.key::" + entry.getKey() + " d1.containsKey()::" + d1.containsKey((String) entry.getKey())); System.err.println("h1.value::" + entry.getValue() + " d1.contains()::" + d1.contains(entry.getValue())); System.err.println("h1.value == d1.value " + entry.getValue().equals(d1.get((String) entry.getKey()))); } throw new RuntimeException(getFailureText(h1, deserializedObject)); } }
Example 11
Source Project: openjdk-8 File: SimpleSerialization.java License: GNU General Public License v2.0 | 5 votes |
public static void main(final String[] args) throws Exception { Hashtable<String, String> h1 = new Hashtable<>(); System.err.println("*** BEGIN TEST ***"); h1.put("key", "value"); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); try (ObjectOutputStream oos = new ObjectOutputStream(baos)) { oos.writeObject(h1); } final byte[] data = baos.toByteArray(); final ByteArrayInputStream bais = new ByteArrayInputStream(data); final Object deserializedObject; try (ObjectInputStream ois = new ObjectInputStream(bais)) { deserializedObject = ois.readObject(); } if(!h1.getClass().isInstance(deserializedObject)) { throw new RuntimeException("Result not assignable to type of h1"); } if (false == h1.equals(deserializedObject)) { Hashtable<String, String> d1 = (Hashtable<String, String>) h1; for(Map.Entry entry: h1.entrySet()) { System.err.println("h1.key::" + entry.getKey() + " d1.containsKey()::" + d1.containsKey((String) entry.getKey())); System.err.println("h1.value::" + entry.getValue() + " d1.contains()::" + d1.contains(entry.getValue())); System.err.println("h1.value == d1.value " + entry.getValue().equals(d1.get((String) entry.getKey()))); } throw new RuntimeException(getFailureText(h1, deserializedObject)); } }
Example 12
Source Project: jdk8u_jdk File: SimpleSerialization.java License: GNU General Public License v2.0 | 5 votes |
public static void main(final String[] args) throws Exception { Hashtable<String, String> h1 = new Hashtable<>(); System.err.println("*** BEGIN TEST ***"); h1.put("key", "value"); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); try (ObjectOutputStream oos = new ObjectOutputStream(baos)) { oos.writeObject(h1); } final byte[] data = baos.toByteArray(); final ByteArrayInputStream bais = new ByteArrayInputStream(data); final Object deserializedObject; try (ObjectInputStream ois = new ObjectInputStream(bais)) { deserializedObject = ois.readObject(); } if(!h1.getClass().isInstance(deserializedObject)) { throw new RuntimeException("Result not assignable to type of h1"); } if (false == h1.equals(deserializedObject)) { Hashtable<String, String> d1 = (Hashtable<String, String>) h1; for(Map.Entry entry: h1.entrySet()) { System.err.println("h1.key::" + entry.getKey() + " d1.containsKey()::" + d1.containsKey((String) entry.getKey())); System.err.println("h1.value::" + entry.getValue() + " d1.contains()::" + d1.contains(entry.getValue())); System.err.println("h1.value == d1.value " + entry.getValue().equals(d1.get((String) entry.getKey()))); } throw new RuntimeException(getFailureText(h1, deserializedObject)); } }
Example 13
Source Project: jdk8u-jdk File: SimpleSerialization.java License: GNU General Public License v2.0 | 5 votes |
public static void main(final String[] args) throws Exception { Hashtable<String, String> h1 = new Hashtable<>(); System.err.println("*** BEGIN TEST ***"); h1.put("key", "value"); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); try (ObjectOutputStream oos = new ObjectOutputStream(baos)) { oos.writeObject(h1); } final byte[] data = baos.toByteArray(); final ByteArrayInputStream bais = new ByteArrayInputStream(data); final Object deserializedObject; try (ObjectInputStream ois = new ObjectInputStream(bais)) { deserializedObject = ois.readObject(); } if(!h1.getClass().isInstance(deserializedObject)) { throw new RuntimeException("Result not assignable to type of h1"); } if (false == h1.equals(deserializedObject)) { Hashtable<String, String> d1 = (Hashtable<String, String>) h1; for(Map.Entry entry: h1.entrySet()) { System.err.println("h1.key::" + entry.getKey() + " d1.containsKey()::" + d1.containsKey((String) entry.getKey())); System.err.println("h1.value::" + entry.getValue() + " d1.contains()::" + d1.contains(entry.getValue())); System.err.println("h1.value == d1.value " + entry.getValue().equals(d1.get((String) entry.getKey()))); } throw new RuntimeException(getFailureText(h1, deserializedObject)); } }
Example 14
Source Project: jdk8u-dev-jdk File: SimpleSerialization.java License: GNU General Public License v2.0 | 5 votes |
public static void main(final String[] args) throws Exception { Hashtable<String, String> h1 = new Hashtable<>(); System.err.println("*** BEGIN TEST ***"); h1.put("key", "value"); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); try (ObjectOutputStream oos = new ObjectOutputStream(baos)) { oos.writeObject(h1); } final byte[] data = baos.toByteArray(); final ByteArrayInputStream bais = new ByteArrayInputStream(data); final Object deserializedObject; try (ObjectInputStream ois = new ObjectInputStream(bais)) { deserializedObject = ois.readObject(); } if(!h1.getClass().isInstance(deserializedObject)) { throw new RuntimeException("Result not assignable to type of h1"); } if (false == h1.equals(deserializedObject)) { Hashtable<String, String> d1 = (Hashtable<String, String>) h1; for(Map.Entry entry: h1.entrySet()) { System.err.println("h1.key::" + entry.getKey() + " d1.containsKey()::" + d1.containsKey((String) entry.getKey())); System.err.println("h1.value::" + entry.getValue() + " d1.contains()::" + d1.contains(entry.getValue())); System.err.println("h1.value == d1.value " + entry.getValue().equals(d1.get((String) entry.getKey()))); } throw new RuntimeException(getFailureText(h1, deserializedObject)); } }