All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.eurodyn.qlack.commons.debug.dump.ArrayDump Maven / Gradle / Ivy

There is a newer version: 1.7.5
Show newest version
package com.eurodyn.qlack.commons.debug.dump;

/**
 * @author European Dynamics SA
 */
public class ArrayDump {

  private ArrayDump() {
  }

  /**
   * Display a dump of the content of an array.
   *
   * @param  - any class object
   * @param array - the array
   */
  public static  void dump(T[] array) {
    for (Object o : array) {
      System.out.println(o.toString());
    }
  }

  /**
   * Concatenate the content of an array to a String, separating each object by a delimiter.
   *
   * @param  - any class object
   * @param array - the array
   * @param delimiter = the separator delimiter
   * @return String
   */
  public static  String stringify(T[] array, String delimiter) {
    StringBuilder sb = new StringBuilder();
    for (Object o : array) {
      sb.append(o.toString());
      sb.append(delimiter);
    }

    return sb.substring(0, sb.length() - delimiter.length());
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy