List of usage examples for java.util Arrays equals
public static boolean equals(Object[] a, Object[] a2)
From source file:org.jasig.cas.DefaultMessageDescriptor.java
@Override public boolean equals(final Object other) { if (other == null || !(other instanceof DefaultMessageDescriptor)) { return false; }//w w w . ja va 2s .c o m if (other == this) { return true; } final DefaultMessageDescriptor m = (DefaultMessageDescriptor) other; return this.code.equals(m.getCode()) && this.defaultMessage.equals(m.getDefaultMessage()) && Arrays.equals(this.params, m.getParams()); }
From source file:eu.europa.esig.dss.validation.OCSPRef.java
/** * @param ocspResp//from w w w . jav a2 s . c o m * @return */ public boolean match(final BasicOCSPResp ocspResp) { if (digestAlgorithm == null) { // -444 return false; } try { MessageDigest digest = DSSUtils.getMessageDigest(digestAlgorithm); if (matchOnlyBasicOCSPResponse) { digest.update(ocspResp.getEncoded()); } else { digest.update(DSSRevocationUtils.fromBasicToResp(ocspResp).getEncoded()); } byte[] computedValue = digest.digest(); if (LOG.isInfoEnabled()) { LOG.info("Compare " + Hex.encodeHexString(digestValue) + " to computed value " + Hex.encodeHexString(computedValue) + " of " + "BasicOCSPResp produced at " + ocspResp.getProducedAt()); } return Arrays.equals(digestValue, computedValue); } catch (IOException e) { throw new DSSException(e); } }
From source file:com.dianping.resource.io.ByteArrayResource.java
/** * This implementation compares the underlying byte array. * @see java.util.Arrays#equals(byte[], byte[]) *///from ww w .j a v a 2s . c o m @Override public boolean equals(Object obj) { return (obj == this || (obj instanceof ByteArrayResource && Arrays.equals(((ByteArrayResource) obj).byteArray, this.byteArray))); }
From source file:com.espertech.esper.collection.TestPermutationEnumeration.java
public static void testGetFactors() { int[] factors = PermutationEnumeration.getFactors(5); assertTrue(Arrays.equals(factors, new int[] { 24, 6, 2, 1, 0 })); factors = PermutationEnumeration.getFactors(4); assertTrue(Arrays.equals(factors, new int[] { 6, 2, 1, 0 })); factors = PermutationEnumeration.getFactors(3); assertTrue(Arrays.equals(factors, new int[] { 2, 1, 0 })); factors = PermutationEnumeration.getFactors(2); assertTrue(Arrays.equals(factors, new int[] { 1, 0 })); factors = PermutationEnumeration.getFactors(1); assertTrue(Arrays.equals(factors, new int[] { 0 })); //log.debug(".testGetFactors " + Arrays.toString(factors)); }
From source file:net.sourceforge.vulcan.spring.jdbc.BuildHistoryQueryTest.java
private void assertWhereClause(String whereClause, Object... params) { final List<SqlParameter> actualParams = new ArrayList<SqlParameter>(); final Object[][] parameterValues = new Object[1][]; final String[] sql = new String[1]; HistoryQueryBuilder.buildQuery(dto, new BuilderQuery() { public void declareParameter(SqlParameter sqlParameter) { actualParams.add(sqlParameter); }//from www. j av a 2 s. c om public void setParameterValues(Object[] pv) { parameterValues[0] = pv; } public void setSql(String string) { sql[0] = string; } }); assertEquals(HistoryQueryBuilder.BUILD_INFO_SQL + whereClause, sql[0]); assertTrue("Expected " + Arrays.toString(params) + " but was " + Arrays.toString(parameterValues[0]), Arrays.equals(params, parameterValues[0])); }
From source file:com.msopentech.odatajclient.proxy.api.impl.AbstractInvocationHandler.java
protected boolean isSelfMethod(final Method method, final Object[] args) { final Method[] selfMethods = getClass().getMethods(); boolean result = false; for (int i = 0; i < selfMethods.length && !result; i++) { result = method.getName().equals(selfMethods[i].getName()) && Arrays.equals(method.getParameterTypes(), selfMethods[i].getParameterTypes()); }/*ww w. ja va 2 s .c o m*/ return result; }
From source file:org.alloy.metal.resource.GeneratedResource.java
@Override public boolean equals(Object res) { if (res == null) return false; if (!getClass().isAssignableFrom(res.getClass())) { return false; }//from ww w .ja va 2 s . c o m return Arrays.equals(source, ((GeneratedResource) res).source); }
From source file:net.darkmist.clf.UtilTest.java
public void testTailInterleavedAB() throws Exception { Integer[] a = new Integer[] { 1, 2, 3, 5, 7, 9 }; Integer[] b = new Integer[] { 4, 6, 8 }; Integer[] expected = new Integer[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; Integer[] actual = new Integer[a.length + b.length]; Util.merge(a, b, actual, comparator); assertTrue(Arrays.equals(actual, expected)); }
From source file:com.tc.object.ApplicatorDNAEncodingTest.java
public void testNonPrimitiveArrays2() throws Exception { final TCByteBufferOutputStream output = new TCByteBufferOutputStream(); final Integer[] array = new Integer[] { new Integer(43), new Integer(-1) }; final ObjectID[] array2 = new ObjectID[] {}; final DNAEncoding encoding = getApplicatorEncoding(); encoding.encodeArray(array, output); encoding.encodeArray(array2, output); final TCByteBufferInputStream input = new TCByteBufferInputStream(output.toArray()); assertTrue(Arrays.equals(array, (Object[]) encoding.decode(input))); assertTrue(Arrays.equals(array2, (Object[]) encoding.decode(input))); assertEquals(0, input.available());//from w w w . ja va 2 s . c om }
From source file:com.qwazr.externalizor.SimplePrimitive.java
@Override public boolean equals(Object o) { if (o == null || !(o instanceof SimplePrimitive)) return false; final SimplePrimitive s = (SimplePrimitive) o; if (intValue != s.intValue) return false; if (!Arrays.equals(intArray, s.intArray)) return false; if (shortValue != s.shortValue) return false; if (!Arrays.equals(shortArray, s.shortArray)) return false; if (longValue != s.longValue) return false; if (!Arrays.equals(longArray, s.longArray)) return false; if (floatValue != s.floatValue) return false; if (!Arrays.equals(floatArray, s.floatArray)) return false; if (doubleValue != s.doubleValue) return false; if (!Arrays.equals(doubleArray, s.doubleArray)) return false; if (!Arrays.equals(emptyDoubleArray, s.emptyDoubleArray)) return false; if (booleanValue != s.booleanValue) return false; if (!Arrays.equals(booleanArray, s.booleanArray)) return false; if (byteValue != s.byteValue) return false; if (!Arrays.equals(byteArray, s.byteArray)) return false; if (charValue != s.charValue) return false; if (!Arrays.equals(charArray, s.charArray)) return false; return true;//www . j a v a 2 s. com }