java.util.Hashtable#equals ( )源码实例Demo

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

源代码1 项目: dragonwell8_jdk   文件: SimpleSerialization.java
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));
    }
}
 
源代码2 项目: TencentKona-8   文件: SimpleSerialization.java
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));
    }
}
 
源代码3 项目: native-obfuscator   文件: SimpleSerialization.java
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));
    }
}
 
源代码4 项目: jdk8u60   文件: SimpleSerialization.java
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));
    }
}
 
源代码5 项目: openjdk-jdk8u   文件: SimpleSerialization.java
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));
    }
}
 
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));
    }
}
 
源代码7 项目: openjdk-jdk9   文件: SimpleSerialization.java
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));
    }
}
 
源代码8 项目: jdk8u-jdk   文件: SimpleSerialization.java
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));
    }
}
 
源代码9 项目: hottub   文件: SimpleSerialization.java
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));
    }
}
 
源代码10 项目: openjdk-8-source   文件: SimpleSerialization.java
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));
    }
}
 
源代码11 项目: openjdk-8   文件: SimpleSerialization.java
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));
    }
}
 
源代码12 项目: jdk8u_jdk   文件: SimpleSerialization.java
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));
    }
}
 
源代码13 项目: jdk8u-jdk   文件: SimpleSerialization.java
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));
    }
}
 
源代码14 项目: jdk8u-dev-jdk   文件: SimpleSerialization.java
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));
    }
}