Java Arrays.deepToString Examples

Java Arrays.deepToString - 30 examples found. These are the top rated real world Java examples of java.util.Arrays.deepToString extracted from open source projects. You can rate examples to help us improve the quality of examples.
    protected void onPostExecute(Void unused) {
      Dialog.dismiss();

      Gson g = new Gson();
      Type collection = new TypeToken<List<Users>>() {}.getType();
      ls = g.fromJson(Content, collection);
      List<String> nameTemp = new ArrayList<>();
      List<String> imageTemp = new ArrayList<>();
      List<Integer> idTemp = new ArrayList<>();
      for (Users u : ls) {
        nameTemp.add(u.getName() + "," + u.getAge());
        imageTemp.add(u.getAvatar());
        idTemp.add(u.getId());
      }

      String[] names = nameTemp.toArray(new String[] {});
      String[] images = imageTemp.toArray(new String[] {});
      Integer[] integerArray = idTemp.toArray(new Integer[0]);
      int[] ids = new int[idTemp.size()];
      for (int i = 0; i < idTemp.size(); i++) {
        ids[i] = idTemp.get(i);
      }

      Log.e(TAG, Arrays.deepToString(names));
      Log.e(TAG, Arrays.deepToString(images));
      Log.e(TAG, ids.toString());
      getDataGridView(names, images, ids);
      ls.clear();
    }
Example #2
0
 public static void print(long timeStamp, Event[] inEvents, Event[] removeEvents) {
   StringBuilder sb = new StringBuilder();
   sb.append("Events{ @timestamp = ")
       .append(timeStamp)
       .append(", inEvents = ")
       .append(Arrays.deepToString(inEvents))
       .append(", RemoveEvents = ")
       .append(Arrays.deepToString(removeEvents))
       .append(" }");
   System.out.println(sb.toString());
 }
Example #3
0
    private void flushBuffer() throws SQLException {
      if (rowBuffer.size() == 0) return;

      // flatten rows into a single params list
      Object[] queryParams = new Object[rowBuffer.size() * fieldNames.length];
      int i = 0;
      for (Object[] row : rowBuffer) for (Object value : row) queryParams[i++] = value;

      setQueryRowCount(rowBuffer.size());

      try {
        SQLUtils.setPreparedStatementParams(stmt, queryParams);
        stmt.execute();
      } catch (SQLException e) {
        try {
          conn.rollback();
        } catch (SQLException ex) {
        }

        try {
          finalize();
        } catch (Throwable thrown) {
        }

        stmt = null;
        conn = null;

        System.err.println("Failed to insert values: " + Arrays.deepToString(rowBuffer.toArray()));
        e = new SQLExceptionWithQuery(baseQuery + "(...)", e);
        throw e;
      } finally {
        rowBuffer.removeAllElements();
      }
    }
Example #4
0
 public static String prettyPrintSequenceRecords(SAMSequenceDictionary sequenceDictionary) {
   String[] sequenceRecordNames = new String[sequenceDictionary.size()];
   int sequenceRecordIndex = 0;
   for (SAMSequenceRecord sequenceRecord : sequenceDictionary.getSequences())
     sequenceRecordNames[sequenceRecordIndex++] = sequenceRecord.getSequenceName();
   return Arrays.deepToString(sequenceRecordNames);
 }
Example #5
0
 /**
  * Produce the deep string value of an array, whatever the actual class type of the array is.
  *
  * @param array the array to get the deep string value of.
  * @return the deep string value of the array, or null if invalid.
  */
 public static String arrayDeepToString(Object array) {
   if (array == null) {
     return null;
   }
   Class<?> clazz = array.getClass();
   if (!clazz.isArray()) {
     return null;
   }
   if (clazz == boolean[].class) {
     return Arrays.toString((boolean[]) array);
   }
   if (clazz == byte[].class) {
     return Arrays.toString((byte[]) array);
   }
   if (clazz == short[].class) {
     return Arrays.toString((short[]) array);
   }
   if (clazz == char[].class) {
     return Arrays.toString((char[]) array);
   }
   if (clazz == int[].class) {
     return Arrays.toString((int[]) array);
   }
   if (clazz == long[].class) {
     return Arrays.toString((long[]) array);
   }
   if (clazz == float[].class) {
     return Arrays.toString((float[]) array);
   }
   if (clazz == double[].class) {
     return Arrays.toString((double[]) array);
   }
   return Arrays.deepToString((Object[]) array);
 }
Example #6
0
 public Container buildContainer(String containerClass) {
   notNull(
       containerClass,
       "Container type " + Arrays.deepToString(Server.values()) + " or container class");
   Class<Container> clazz = null;
   for (Server container : Server.values()) {
     if (container.name().equalsIgnoreCase(containerClass)) {
       clazz = loadServerClass(container.serverClass());
       break;
     }
   }
   if (clazz == null) clazz = loadServerClass(containerClass);
   try {
     return clazz
         .getConstructor(ContainerConfiguration.class)
         .newInstance(ContainerConfiguration.from(this));
   } catch (InvocationTargetException e) {
     if (e.getTargetException() instanceof RuntimeException)
       throw (RuntimeException) e.getTargetException();
     else throw new RuntimeException(e.getTargetException().getMessage(), e.getTargetException());
   } catch (Exception e) {
     throw new IllegalArgumentException(
         "Cannot instanciate class ["
             + clazz
             + "]. Ensure there is a public constructor having a parameter of type "
             + ContainerConfiguration.class.getName(),
         e);
   }
 }