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

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

源代码1 项目: dragonwell8_jdk   文件: SimpleSerialization.java
public static void main(final String[] args) throws Exception {
    final Vector<String> v1 = new Vector<>();

    v1.add("entry1");
    v1.add("entry2");

    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    final ObjectOutputStream oos = new ObjectOutputStream(baos);

    oos.writeObject(v1);
    oos.close();

    final byte[] data = baos.toByteArray();
    final ByteArrayInputStream bais = new ByteArrayInputStream(data);
    final ObjectInputStream ois = new ObjectInputStream(bais);

    final Object deserializedObject = ois.readObject();
    ois.close();

    if (false == v1.equals(deserializedObject)) {
        throw new RuntimeException(getFailureText(v1, deserializedObject));
    }
}
 
源代码2 项目: TencentKona-8   文件: SimpleSerialization.java
public static void main(final String[] args) throws Exception {
    final Vector<String> v1 = new Vector<>();

    v1.add("entry1");
    v1.add("entry2");

    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    final ObjectOutputStream oos = new ObjectOutputStream(baos);

    oos.writeObject(v1);
    oos.close();

    final byte[] data = baos.toByteArray();
    final ByteArrayInputStream bais = new ByteArrayInputStream(data);
    final ObjectInputStream ois = new ObjectInputStream(bais);

    final Object deserializedObject = ois.readObject();
    ois.close();

    if (false == v1.equals(deserializedObject)) {
        throw new RuntimeException(getFailureText(v1, deserializedObject));
    }
}
 
源代码3 项目: native-obfuscator   文件: SimpleSerialization.java
public static void main(final String[] args) throws Exception {
    final Vector<String> v1 = new Vector<>();

    v1.add("entry1");
    v1.add("entry2");

    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    final ObjectOutputStream oos = new ObjectOutputStream(baos);

    oos.writeObject(v1);
    oos.close();

    final byte[] data = baos.toByteArray();
    final ByteArrayInputStream bais = new ByteArrayInputStream(data);
    final ObjectInputStream ois = new ObjectInputStream(bais);

    final Object deserializedObject = ois.readObject();
    ois.close();

    if (false == v1.equals(deserializedObject)) {
        throw new RuntimeException(getFailureText(v1, deserializedObject));
    }
}
 
源代码4 项目: jdk8u60   文件: SimpleSerialization.java
public static void main(final String[] args) throws Exception {
    final Vector<String> v1 = new Vector<>();

    v1.add("entry1");
    v1.add("entry2");

    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    final ObjectOutputStream oos = new ObjectOutputStream(baos);

    oos.writeObject(v1);
    oos.close();

    final byte[] data = baos.toByteArray();
    final ByteArrayInputStream bais = new ByteArrayInputStream(data);
    final ObjectInputStream ois = new ObjectInputStream(bais);

    final Object deserializedObject = ois.readObject();
    ois.close();

    if (false == v1.equals(deserializedObject)) {
        throw new RuntimeException(getFailureText(v1, deserializedObject));
    }
}
 
源代码5 项目: openjdk-jdk8u   文件: SimpleSerialization.java
public static void main(final String[] args) throws Exception {
    final Vector<String> v1 = new Vector<>();

    v1.add("entry1");
    v1.add("entry2");

    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    final ObjectOutputStream oos = new ObjectOutputStream(baos);

    oos.writeObject(v1);
    oos.close();

    final byte[] data = baos.toByteArray();
    final ByteArrayInputStream bais = new ByteArrayInputStream(data);
    final ObjectInputStream ois = new ObjectInputStream(bais);

    final Object deserializedObject = ois.readObject();
    ois.close();

    if (false == v1.equals(deserializedObject)) {
        throw new RuntimeException(getFailureText(v1, deserializedObject));
    }
}
 
public static void main(final String[] args) throws Exception {
    final Vector<String> v1 = new Vector<>();

    v1.add("entry1");
    v1.add("entry2");

    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    final ObjectOutputStream oos = new ObjectOutputStream(baos);

    oos.writeObject(v1);
    oos.close();

    final byte[] data = baos.toByteArray();
    final ByteArrayInputStream bais = new ByteArrayInputStream(data);
    final ObjectInputStream ois = new ObjectInputStream(bais);

    final Object deserializedObject = ois.readObject();
    ois.close();

    if (false == v1.equals(deserializedObject)) {
        throw new RuntimeException(getFailureText(v1, deserializedObject));
    }
}
 
源代码7 项目: openjdk-jdk9   文件: SetNativesTest.java
public void verifyNewMappings() {
    // Enumerate through all natives
    for (Enumeration e = hashVerify.keys() ; e.hasMoreElements() ;) {
        String key = (String)e.nextElement();

        java.util.List listFlavors = flavorMap.getFlavorsForNative(key);
        Vector vectorFlavors = new Vector(listFlavors);

        // Compare the list of DataFlavors
        if ( !vectorFlavors.equals((Vector)hashVerify.get(key))) {
            throw new RuntimeException("\n*** Error in verifyNewMappings()" +
                "\nmethod1: setFlavorsForNative(String nat, DataFlavors[] flavors)" +
                "\nmethod2: List getFlavorsForNative(String nat)" +
                "\nString native: " + key +
                "\nThe Returned List did not match the original set of DataFlavors.");
        }
    }
    System.out.println("*** native size = " + hashVerify.size());
}
 
源代码8 项目: openjdk-jdk9   文件: SimpleSerialization.java
public static void main(final String[] args) throws Exception {
    final Vector<String> v1 = new Vector<>();

    v1.add("entry1");
    v1.add("entry2");

    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    final ObjectOutputStream oos = new ObjectOutputStream(baos);

    oos.writeObject(v1);
    oos.close();

    final byte[] data = baos.toByteArray();
    final ByteArrayInputStream bais = new ByteArrayInputStream(data);
    final ObjectInputStream ois = new ObjectInputStream(bais);

    final Object deserializedObject = ois.readObject();
    ois.close();

    if (false == v1.equals(deserializedObject)) {
        throw new RuntimeException(getFailureText(v1, deserializedObject));
    }
}
 
源代码9 项目: jdk8u-jdk   文件: SimpleSerialization.java
public static void main(final String[] args) throws Exception {
    final Vector<String> v1 = new Vector<>();

    v1.add("entry1");
    v1.add("entry2");

    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    final ObjectOutputStream oos = new ObjectOutputStream(baos);

    oos.writeObject(v1);
    oos.close();

    final byte[] data = baos.toByteArray();
    final ByteArrayInputStream bais = new ByteArrayInputStream(data);
    final ObjectInputStream ois = new ObjectInputStream(bais);

    final Object deserializedObject = ois.readObject();
    ois.close();

    if (false == v1.equals(deserializedObject)) {
        throw new RuntimeException(getFailureText(v1, deserializedObject));
    }
}
 
源代码10 项目: hottub   文件: SimpleSerialization.java
public static void main(final String[] args) throws Exception {
    final Vector<String> v1 = new Vector<>();

    v1.add("entry1");
    v1.add("entry2");

    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    final ObjectOutputStream oos = new ObjectOutputStream(baos);

    oos.writeObject(v1);
    oos.close();

    final byte[] data = baos.toByteArray();
    final ByteArrayInputStream bais = new ByteArrayInputStream(data);
    final ObjectInputStream ois = new ObjectInputStream(bais);

    final Object deserializedObject = ois.readObject();
    ois.close();

    if (false == v1.equals(deserializedObject)) {
        throw new RuntimeException(getFailureText(v1, deserializedObject));
    }
}
 
源代码11 项目: openjdk-8-source   文件: SimpleSerialization.java
public static void main(final String[] args) throws Exception {
    final Vector<String> v1 = new Vector<>();

    v1.add("entry1");
    v1.add("entry2");

    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    final ObjectOutputStream oos = new ObjectOutputStream(baos);

    oos.writeObject(v1);
    oos.close();

    final byte[] data = baos.toByteArray();
    final ByteArrayInputStream bais = new ByteArrayInputStream(data);
    final ObjectInputStream ois = new ObjectInputStream(bais);

    final Object deserializedObject = ois.readObject();
    ois.close();

    if (false == v1.equals(deserializedObject)) {
        throw new RuntimeException(getFailureText(v1, deserializedObject));
    }
}
 
源代码12 项目: openjdk-8   文件: SimpleSerialization.java
public static void main(final String[] args) throws Exception {
    final Vector<String> v1 = new Vector<>();

    v1.add("entry1");
    v1.add("entry2");

    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    final ObjectOutputStream oos = new ObjectOutputStream(baos);

    oos.writeObject(v1);
    oos.close();

    final byte[] data = baos.toByteArray();
    final ByteArrayInputStream bais = new ByteArrayInputStream(data);
    final ObjectInputStream ois = new ObjectInputStream(bais);

    final Object deserializedObject = ois.readObject();
    ois.close();

    if (false == v1.equals(deserializedObject)) {
        throw new RuntimeException(getFailureText(v1, deserializedObject));
    }
}
 
源代码13 项目: jdk8u_jdk   文件: SimpleSerialization.java
public static void main(final String[] args) throws Exception {
    final Vector<String> v1 = new Vector<>();

    v1.add("entry1");
    v1.add("entry2");

    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    final ObjectOutputStream oos = new ObjectOutputStream(baos);

    oos.writeObject(v1);
    oos.close();

    final byte[] data = baos.toByteArray();
    final ByteArrayInputStream bais = new ByteArrayInputStream(data);
    final ObjectInputStream ois = new ObjectInputStream(bais);

    final Object deserializedObject = ois.readObject();
    ois.close();

    if (false == v1.equals(deserializedObject)) {
        throw new RuntimeException(getFailureText(v1, deserializedObject));
    }
}
 
源代码14 项目: jdk8u-jdk   文件: SimpleSerialization.java
public static void main(final String[] args) throws Exception {
    final Vector<String> v1 = new Vector<>();

    v1.add("entry1");
    v1.add("entry2");

    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    final ObjectOutputStream oos = new ObjectOutputStream(baos);

    oos.writeObject(v1);
    oos.close();

    final byte[] data = baos.toByteArray();
    final ByteArrayInputStream bais = new ByteArrayInputStream(data);
    final ObjectInputStream ois = new ObjectInputStream(bais);

    final Object deserializedObject = ois.readObject();
    ois.close();

    if (false == v1.equals(deserializedObject)) {
        throw new RuntimeException(getFailureText(v1, deserializedObject));
    }
}
 
源代码15 项目: jdk8u-dev-jdk   文件: SimpleSerialization.java
public static void main(final String[] args) throws Exception {
    final Vector<String> v1 = new Vector<>();

    v1.add("entry1");
    v1.add("entry2");

    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    final ObjectOutputStream oos = new ObjectOutputStream(baos);

    oos.writeObject(v1);
    oos.close();

    final byte[] data = baos.toByteArray();
    final ByteArrayInputStream bais = new ByteArrayInputStream(data);
    final ObjectInputStream ois = new ObjectInputStream(bais);

    final Object deserializedObject = ois.readObject();
    ois.close();

    if (false == v1.equals(deserializedObject)) {
        throw new RuntimeException(getFailureText(v1, deserializedObject));
    }
}
 
源代码16 项目: netbeans   文件: KeyMapTest.java
public void testProfileRestore() {
    KeyMapOperator kmo = null;
    boolean closed = true;
    try {
        kmo = KeyMapOperator.invoke();
        closed = false;
        Vector<String> shortcuts = kmo.getAllShortcutsForAction("Preview Design");
        kmo.assignShortcutToAction("Preview Design", true, true, false, KeyEvent.VK_W, true, true);
        if (shortcuts.equals(kmo.getAllShortcutsForAction("Preview Design"))) {
            fail("Problem with assigning shortcut to Preview Design");
        }
        kmo.ok().push();
        closed = true;
        kmo = KeyMapOperator.invoke();
        closed = false;
        kmo.actionSearchByName().setText("Preview Design");
        kmo.restoreProfile("NetBeans");
        Vector<String> sc = kmo.getAllShortcutsForAction("Preview Design");
        if (!shortcuts.equals(sc)) {
            // This test currently fails: http://www.netbeans.org/issues/show_bug.cgi?id=151254
            fail("Problem with restoring NetBeans profile (http://www.netbeans.org/issues/show_bug.cgi?id=151254) - \"Preview Design\" action: " + shortcuts.toString() + " vs. " + sc.toString());
        }
        kmo.ok().push();
        closed = true;
    } finally {
        if (!closed && kmo != null) {
            kmo.cancel().push();
        }
    }
}
 
源代码17 项目: openjdk-jdk9   文件: GetNativesForNewFlavorTest.java
public void doTest() throws Exception {
    // Initialize DataFlavors and arrays used for test data
    initMappings();

    boolean passed = true;
    flavorMap = (SystemFlavorMap)SystemFlavorMap.getDefaultFlavorMap();

    // Get all the native strings and preferred DataFlavor mappings
    hash = new Hashtable(flavorMap.getFlavorsForNatives(null));
    hashSize = hash.size();

    // GetNativesForFlavor using unknown DataFlavor (verify 2-way mapping)
    //
    // If a new DataFlavor is specified, the method should establish a mapping
    // in both directions between specified DataFlavor and an encoded
    // version of its MIME type as its native.
    System.out.println("GetNativesForFlavor using new DataFlavor");

    comp1 = new Vector(Arrays.asList(test_natives_set));
    comp2 = new Vector(flavorMap.getNativesForFlavor(test_flavor1));

    comp3 = new Vector(Arrays.asList(test_flavors_set));
    comp4 = new Vector(flavorMap.getFlavorsForNative(test_encoded));

    if ( !comp1.equals(comp2) || !comp3.equals(comp4) ) {
        throw new RuntimeException("\n*** After passing a new DataFlavor" +
            "\nwith getNativesForFlavor(DataFlavor flav)" +
            "\nthe mapping in both directions was not established.");
    }
    else
       System.out.println("GetNativesForFlavor using new DataFlavor: Test Passes");
}
 
源代码18 项目: org.openntf.domino   文件: DocumentEntrySet.java
@SuppressWarnings("rawtypes")
@Override
public boolean equals(final Object obj) {
	if (this == obj) {
		return true;
	}
	if (!(obj instanceof DocumentEntrySet)) {
		return false;
	}
	DocumentEntrySet other = (DocumentEntrySet) obj;
	Set<String> myKeySet = doc.keySet();
	Object otherKeySet = other.doc.keySet();
	if (!myKeySet.equals(otherKeySet))
		return false;
	for (String key : myKeySet) {
		Vector myVal = doc.getItemValue(key);
		Vector otherVal = other.doc.getItemValue(key);
		if (myVal == null && otherVal == null) {
			// nop
		} else if (myVal == null || otherVal == null) {
			return false;
		} else if (!myVal.equals(otherVal)) {
			return false;
		}
	}
	return true;

}
 
源代码19 项目: netbeans   文件: KeyMapTest.java
public void testAddDuplicateCancel() {
    KeyMapOperator kmo = null;
    boolean closed = true;
    try {
        kmo = KeyMapOperator.invoke();
        closed = false;
        kmo.selectProfile(PROFILE_DEFAULT);
        Vector<String> shortcuts = kmo.getAllShortcutsForAction("select line");
        kmo.assignShortcutToAction("select line", false, true, true, KeyEvent.VK_F9, true, false);
        shortcuts.equals(kmo.getAllShortcutsForAction("select line"));
        kmo.ok().push();
        closed = true;
        kmo = KeyMapOperator.invoke();
        closed = false;
        kmo.selectProfile(PROFILE_DEFAULT);
        kmo.assignShortcutToAction("select line", false, true, true, KeyEvent.VK_F9, true, true);
        kmo.ok().push();
        closed = true;
        new EventTool().waitNoEvent(2000);
        editor.requestFocus();
        new EventTool().waitNoEvent(100);
        // Check ALT+Shift+G works for select line
        editor.setCaretPosition(55, 1);
        ValueResolver vr = new ValueResolver() {

            @Override
            public Object getValue() {
                editor.pushKey(KeyEvent.VK_F9, KeyEvent.ALT_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK);
                String selected = editor.txtEditorPane().getSelectedText();
                new EventTool().waitNoEvent(100);
                if (selected == null) {
                    return false;
                }
                return selected.startsWith("public class Main {");
            }
        };
        waitMaxMilisForValue(3000, vr, Boolean.TRUE);
        String text = editor.txtEditorPane().getSelectedText();
        assertEquals("public class Main {", text.trim());
    } catch (Exception e) {
        System.out.println("ERROR: testAddDuplicateCancel");
        e.printStackTrace(System.out);
        fail(e);
    } finally {
        if (!closed && kmo != null) {
            kmo.cancel().push();
            editor.close(false);
        }
    }
}
 
源代码20 项目: Shuffle-Move   文件: MoveChooserService.java
@Override
protected void updateGUIFrom(ShuffleMenuUser user) {
   updateTooltips(user);
   updateComponentText(user);
   Collection<SimulationResult> userResults = user.getResults();
   SimulationResult selectResult = user.getSelectedResult();
   if (listener2 != null) {
      table.getSelectionModel().removeListSelectionListener(listener2);
      results.clear();
      resultsMap.clear();
      loadOrderFor(table, user.getPreferencesManager().getStringValue(KEY_COLUMN_ORDER));
      if (model2.getRowCount() > 0) {
         for (int i = model2.getRowCount() - 1; i >= 0; i--) {
            model2.removeRow(i);
         }
      }
      Vector<String> columNames = getColumnNames();
      Vector<String> curNames = new Vector<String>();
      for (int i = 0; i < model2.getColumnCount(); i++) {
         curNames.add(model2.getColumnName(i));
      }
      if (!curNames.equals(columNames)) {
         model2.setColumnIdentifiers(columNames);
      }
      if (userResults != null) {
         for (SimulationResult result : userResults) {
            resultsMap.put(result, results.size());
            model2.addRow(getVectorFor(result, results.size() + 1));
            results.add(result);
         }
      }
      if (selectResult == null) {
         table.clearSelection();
         
      } else {
         int row = resultsMap.get(selectResult);
         table.setRowSelectionInterval(row, row);
      }
      resizeColumnWidth(table);
      table.repaint();
      table.getSelectionModel().addListSelectionListener(listener2);
   }
   ind.repaint();
}