当前位置: 首页>>代码示例>>Java>>正文


Java Vector.equals方法代码示例

本文整理汇总了Java中java.util.Vector.equals方法的典型用法代码示例。如果您正苦于以下问题:Java Vector.equals方法的具体用法?Java Vector.equals怎么用?Java Vector.equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.Vector的用法示例。


在下文中一共展示了Vector.equals方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import java.util.Vector; //导入方法依赖的package包/类
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));
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:24,代码来源:SimpleSerialization.java

示例2: verifyNewMappings

import java.util.Vector; //导入方法依赖的package包/类
public void verifyNewMappings() {
    // Enumerate through all DataFlavors
    for (Enumeration e = hashVerify.keys() ; e.hasMoreElements() ;) {
        DataFlavor key = (DataFlavor)e.nextElement();

        java.util.List listNatives = flavorMap.getNativesForFlavor(key);
        Vector vectorFlavors = new Vector(listNatives);

        // Compare the list of Natives
        if ( !vectorFlavors.equals(hashVerify.get(key))) {
            throw new RuntimeException("\n*** Error in verifyNewMappings()" +
                "\nmethod1: setNativesForFlavor(DataFlavor flav, String[] natives)" +
                "\nmethod2: List getNativesForFlavor(DataFlavor flav)" +
                "\nDataFlavor: " + key.getMimeType() +
                "\nThe Returned List did not match the original set of Natives.");
        }
    }
    System.out.println("*** DataFlavor size = " + hashVerify.size());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:SetDataFlavorsTest.java

示例3: verifyNewMappings

import java.util.Vector; //导入方法依赖的package包/类
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());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:SetNativesTest.java

示例4: testProfileRestore

import java.util.Vector; //导入方法依赖的package包/类
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();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:KeyMapTest.java

示例5: hasChanged

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Checks if the current settings have changed.
 * @return true, if the data model was changed
 */
private boolean hasChanged() {
	
	boolean changed = false;
	NetworkComponentAdapter4DataModel nca4dm = this.getNetworkComponentAdapter4DataModel();
	if (nca4dm!=null) {
		nca4dm.save();
		this.newDataModel = nca4dm.getDataModel();
		this.newDataModelBase64 = nca4dm.getDataModelBase64Encoded(this.newDataModel);
		Vector<Integer> newHashCodes = this.getHashCodeVectorFromDataModel(newDataModelBase64);
		changed = !newHashCodes.equals(this.dataModelInitialHashCodes);
	}
	return changed;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:18,代码来源:BasicGraphGuiProperties.java

示例6: doTest

import java.util.Vector; //导入方法依赖的package包/类
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");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:33,代码来源:GetNativesForNewFlavorTest.java

示例7: testAddDuplicateCancel

import java.util.Vector; //导入方法依赖的package包/类
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);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:51,代码来源:KeyMapTest.java


注:本文中的java.util.Vector.equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。