Java Arrays.hashCode Examples

Java Arrays.hashCode - 30 examples found. These are the top rated real world Java examples of java.util.Arrays.hashCode extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
0
 public int hashCode() {
   // I just made this up. If two rules are equal they'll have the
   // same hashcode. Maybe someone else can do a better job though?
   int frHash = Arrays.hashCode(getFrench());
   int enHash = Arrays.hashCode(english);
   return frHash ^ enHash ^ getLHS();
 }
 @Override
 public int hashCode() {
   int hash = 5;
   hash = 47 * hash + Arrays.hashCode(this.alpha);
   hash = 47 * hash + Arrays.hashCode(this.beta);
   return hash;
 }
Example #3
0
 @Override
 public int hashCode() {
   int result = super.hashCode();
   result = 31 * result + (context != null ? context.hashCode() : 0);
   result = 31 * result + (className != null ? className.hashCode() : 0);
   result = 31 * result + (superClass != null ? superClass.hashCode() : 0);
   result = 31 * result + (interfaces != null ? interfaces.hashCode() : 0);
   result = 31 * result + (scope != null ? scope.hashCode() : 0);
   result = 31 * result + (isArray ? 1 : 0);
   result = 31 * result + dimensions;
   result = 31 * result + (isInterface ? 1 : 0);
   result = 31 * result + (isAbstract ? 1 : 0);
   result = 31 * result + (isFinal ? 1 : 0);
   result = 31 * result + (isStatic ? 1 : 0);
   result = 31 * result + (isInner ? 1 : 0);
   result = 31 * result + (methods != null ? methods.hashCode() : 0);
   result = 31 * result + (fields != null ? fields.hashCode() : 0);
   result = 31 * result + (constructors != null ? constructors.hashCode() : 0);
   result = 31 * result + (typeVariables != null ? typeVariables.hashCode() : 0);
   result = 31 * result + (reifiedFormOf != null ? reifiedFormOf.hashCode() : 0);
   result = 31 * result + (_nameCache != null ? _nameCache.hashCode() : 0);
   result = 31 * result + (_methodsCache != null ? Arrays.hashCode(_methodsCache) : 0);
   result = 31 * result + (_fieldsCache != null ? Arrays.hashCode(_fieldsCache) : 0);
   result = 31 * result + (_constructorsCache != null ? Arrays.hashCode(_constructorsCache) : 0);
   result = 31 * result + (generatedCache != null ? generatedCache.hashCode() : 0);
   return result;
 }
Example #4
0
  public static String printArray(byte[] array, boolean withHash) {
    if (array == null) return "null";

    int limit = 8;
    StringBuilder sb = new StringBuilder();
    sb.append("[B0x");
    if (array.length <= limit || IS_ARRAYS_DEBUG) {
      // Convert the entire byte array
      sb.append(toHexString(array));
      if (withHash) {
        sb.append(",h=");
        sb.append(Integer.toHexString(Arrays.hashCode(array)));
        sb.append(']');
      }
    } else {
      // Pick the first 8 characters and convert that part
      sb.append(toHexString(array, limit));
      sb.append("..[");
      sb.append(array.length);
      if (withHash) {
        sb.append("],h=");
        sb.append(Integer.toHexString(Arrays.hashCode(array)));
      }
      sb.append(']');
    }
    return sb.toString();
  }
  @Test
  public void test_2GB_over() throws IOException {
    Assume.assumeTrue(CC.FULL_TEST);

    byte[] data = new byte[51111];
    int dataHash = Arrays.hashCode(data);

    Set<Long> recids = new TreeSet<Long>();

    for (int i = 0; i < 1e5; i++) {
      long recid = engine.recordPut(data, Serializer.BYTE_ARRAY_SERIALIZER);
      recids.add(recid);

      //            if(i%10000==0){
      //            System.out.println(recid);
      //            for(Long l:recids){
      //                byte[] b = engine.recordGet(l, Serializer.BYTE_ARRAY_SERIALIZER);
      //                int hash = Arrays.hashCode(b);
      //                assertEquals(l,dataHash, hash);
      //            }
      //            }

    }

    engine.commit();

    for (Long l : recids) {
      byte[] b = engine.recordGet(l, Serializer.BYTE_ARRAY_SERIALIZER);
      int hash = Arrays.hashCode(b);
      assertEquals(dataHash, hash);
    }
  }
 public void ___testGetAllFontsNames() {
   NRC_HTMLDocumentByCobra doc = null;
   try {
     doc = new NRC_HTMLDocumentByCobra("http://localhost/tests/testfonts.html");
     String[] fontNames = doc.getAllFontsNames();
     doc.close();
     Arrays.sort(fontNames);
     String[] namesExpected =
         new String[] {
           "nunacom",
           "Verdana",
           "Arial",
           "Helvetica",
           "sans-serif",
           "Naamajut",
           "Times New Roman",
           "georgia",
           "PROSYL"
         };
     Arrays.sort(namesExpected);
     assertTrue(
         "Les noms des polices retournés pour testfonts.html ne sont pas corrects",
         Arrays.hashCode(fontNames) == Arrays.hashCode(namesExpected));
   } catch (Exception e) {
     e.printStackTrace();
     if (doc != null) doc.close();
     fail();
   }
 }