List of usage examples for java.util Vector equals
public synchronized boolean equals(Object o)
From source file:MainClass.java
public static void main(String args[]) { Vector v = new Vector(5); for (int i = 0; i < 10; i++) { v.add(0, i);//from w w w .j ava2s . c om } System.out.println(v); Vector v2 = new Vector(5); for (int i = 0; i < 10; i++) { v2.add(0, i); } System.out.println(v2); System.out.println(v2.equals(v)); }
From source file:MainClass.java
public static void main(String args[]) { Vector v = new Vector(5); for (int i = 0; i < 10; i++) { v.add(0, i);/*from www .ja va 2 s .com*/ } System.out.println(v); Vector v2 = new Vector(5); for (int i = 0; i < 5; i++) { v2.add(0, i); } System.out.println(v2); System.out.println(v2.equals(v)); v.retainAll(v2); System.out.println(v); }
From source file:MainClass.java
public static void main(String args[]) { Vector v1 = new Vector(); v1.add("A");/*w w w . ja v a 2 s.c o m*/ v1.add("B"); v1.add("C"); Vector v2 = new Vector(); v2.add("A"); v2.add("B"); System.out.println(v1.equals(v2)); }
From source file:Main.java
public static void main(String args[]) { Vector<Integer> v = new Vector<Integer>(5); for (int i = 0; i < 10; i++) { v.add(0, i);/*from w ww . j av a2 s . com*/ } System.out.println(v); Vector<Integer> v2 = new Vector<Integer>(5); for (int i = 0; i < 10; i++) { v2.add(0, i); } System.out.println(v2); System.out.println(v2.equals(v)); v2.removeAll(v); System.out.println(v2); }
From source file:Main.java
public static void main(String[] args) { Vector<Integer> firstvec = new Vector<Integer>(4); Vector<Integer> secondvec = new Vector<Integer>(4); // additing in firstvec firstvec.add(4);/*from w w w . java2 s. co m*/ firstvec.add(3); firstvec.add(2); // additing in secondvec secondvec.add(4); secondvec.add(3); secondvec.add(2); // let us print all the elements available in vector System.out.println("Testing equality of firstvec and secondvec :" + firstvec.equals(secondvec)); }
From source file:Main.java
/** * Please use Vector.equals() or List.equals() * * @since Ant 1.5//from w w w . j a va2 s .c om * @deprecated */ public static boolean equals(Vector v1, Vector v2) { if (v1 == v2) { return true; } if (v1 == null || v2 == null) { return false; } return v1.equals(v2); }
From source file:Main.java
/** * Please use Vector.equals() or List.equals(). * @param v1 the first vector./*from w w w . j a va2 s . co m*/ * @param v2 the second vector. * @return true if the vectors are equal. * @since Ant 1.5 * @deprecated since 1.6.x. */ public static boolean equals(Vector<?> v1, Vector<?> v2) { if (v1 == v2) { return true; } if (v1 == null || v2 == null) { return false; } return v1.equals(v2); }
From source file:com.github.igor_kudryashov.utils.notes.NotesDocument.java
/** * As lotus.domino.Document.replaceItemValue() method modifies the value of the document Lotus * Notes, but only if the new value is different from existing * * @param item//from w w w . jav a 2 s . com * - the lotus.Domino.Item object. * @param value * - the new value of Notes item. * @return <code>true</code> if the value has been updated, <code>false</code> otherwise. * @throws NotesException */ @SuppressWarnings("unchecked") public static boolean updateItemValue(Item item, Object value) throws NotesException { Vector<Object> vec = item.getValues(); if (value.getClass().getName().contains("Vector")) { if (vec.equals(value)) { return false; } else { item.setValues((Vector<Object>) value); } } else { if (vec.size() == 1) { if (vec.firstElement() instanceof Number) { // because lotus.docmino.Item.getValues() alvays return java.util.Vector with // Double elements for Numeric items, // value parameter must be converted to Double MutableDouble md = new MutableDouble((Number) value); if (Double.compare((Double) vec.firstElement(), md.getValue()) == 0) { return false; } } else if (vec.firstElement() instanceof String) { if (vec.firstElement().equals((String) value)) { return false; } } else { if (vec.firstElement().equals(value)) { return false; } } } vec = new Vector<Object>(); vec.add(value); item.setValues(vec); } return true; }
From source file:org.apache.fop.complexscripts.bidi.DelimitedTextRange.java
/** * <p>Assign resolved levels to all text intervals of this delimited text range.</p> * <p>Has a possible side effect of replacing the intervals array with a new array * containing new text intervals, such that each text interval is associated with * a single level run.</p>/*ww w. j av a2s. co m*/ * @param levels array of levels each corresponding to each index of the delimited * text range */ private void assignLevels(int[] levels) { Vector intervalsNew = new Vector(intervals.size()); for (Iterator it = intervals.iterator(); it.hasNext();) { TextInterval ti = (TextInterval) it.next(); intervalsNew.addAll(assignLevels(ti, levels)); } if (!intervalsNew.equals(intervals)) { intervals = intervalsNew; } }
From source file:org.wso2.carbon.security.util.ServerCrypto.java
@Override /**//from w ww. j ava 2 s . c om * @see org.apache.ws.security.components.crypto.Crypto#getAliasesForDN(java.lang.String) */ public String[] getAliasesForDN(String subjectDN) throws WSSecurityException { // Store the aliases found Vector aliases = new Vector(); Certificate cert; // The DN to search the keystore for Vector subjectRDN = splitAndTrim(subjectDN); // Look at every certificate in the keystore try { for (Enumeration e = keystore.aliases(); e.hasMoreElements();) { String alias = (String) e.nextElement(); Certificate[] certs = this.getCertificates(alias); if (certs == null || certs.length == 0) { return new String[0]; } else { cert = certs[0]; } if (cert instanceof X509Certificate) { Vector foundRDN = splitAndTrim(((X509Certificate) cert).getSubjectDN().getName()); if (subjectRDN.equals(foundRDN)) { aliases.add(alias); } } } } catch (KeyStoreException e) { throw new WSSecurityException(WSSecurityException.FAILURE, "keystore"); } // Convert the vector into an array String[] result = new String[aliases.size()]; for (int i = 0; i < aliases.size(); i++) { result[i] = (String) aliases.elementAt(i); } return result; }