/** * Prints an object to the console. * * @param message object to print. */ public static void println(Object message) { print(message); println(); }
/** * Print a single object to the console. * If null prints out >NULL< * If char[] converts to String. * If array prints out string version of array * by first converting array to a list. * If any object, then it uses the toString to print out the object. * * @param message the object that you wish to print. */ public static void print(Object message) { if (message == null) { print("<NULL>"); } else if (message instanceof char[]) { print(FastStringUtils.noCopyStringFromChars((char[]) message)); } else if (message.getClass().isArray()) { print(Lists.toListOrSingletonList(message).toString()); } else { print(message.toString()); } }
/** * Prints an object to the console. * * @param message object to print. */ public static void println(Object message) { print(message); println(); }
/** * Print a single object to the console. * If null prints out >NULL< * If char[] converts to String. * If array prints out string version of array * by first converting array to a list. * If any object, then it uses the toString to print out the object. * * @param message the object that you wish to print. */ public static void print(Object message) { if (message == null) { print("<NULL>"); } else if (message instanceof char[]) { print(FastStringUtils.noCopyStringFromChars((char[]) message)); } else if (message.getClass().isArray()) { print(Lists.toListOrSingletonList(message).toString()); } else { print(message.toString()); } }
/** * Like print, but prints out a whole slew of objects on the same line. * * @param messages objects you want to print on the same line. */ public static void puts(Object... messages) { for (Object message : messages) { IO.print(message); if (!(message instanceof Terminal.Escape)) IO.print(' '); } IO.println(); }
/** * <p> * Like puts but prints out each object on its own line. * If the object is a list or array, * then each item in the list gets printed out on its own line. * </p> * * @param messages the stuff you want to print out. */ public static void putl(Object... messages) { for (Object message : messages) { if (message instanceof Collection || Typ.isArray(message)) { Iterator iterator = Conversions.iterator(message); while (iterator.hasNext()) { puts(iterator.next()); } continue; } print(message); println(); } println(); }
/** * <p> * Like puts but prints out each object on its own line. * If the object is a list or array, * then each item in the list gets printed out on its own line. * </p> * * @param messages the stuff you want to print out. */ public static void putl(Object... messages) { for (Object message : messages) { if (message instanceof Collection || Typ.isArray(message)) { Iterator iterator = Conversions.iterator(message); while (iterator.hasNext()) { puts(iterator.next()); } continue; } print(message); println(); } println(); }