private String getInfoFormat(List<WorkerInfo> workerInfoList, boolean isShort) {
    int maxWorkerNameLength = workerInfoList.stream().map(w -> w.getAddress().getHost().length())
        .max(Comparator.comparing(Integer::intValue)).get();
    int firstIndent = 16;
    if (firstIndent <= maxWorkerNameLength) {
      // extend first indent according to the longest worker name by default 5
      firstIndent = maxWorkerNameLength + 5;
    }
    if (isShort) {
      return "%-" + firstIndent + "s %-16s %-13s %s";
    }
    return "%-" + firstIndent + "s %-16s %-13s %-16s %s";
  }
private String getInfoFormat ( List < WorkerInfo > workerInfoList , boolean isShort ) { int maxWorkerNameLength = workerInfoList . stream ( ) . map ( w -> w . getAddress ( ) . getHost ( ) . length ( ) ) . max ( Comparator . comparing ( Integer :: intValue ) ) . get ( ) ; int firstIndent = 16 ; if ( firstIndent <= maxWorkerNameLength ) { firstIndent = maxWorkerNameLength + 5 ; } if ( isShort ) { return "%-" + firstIndent + "s %-16s %-13s %s" ; } return "%-" + firstIndent + "s %-16s %-13s %-16s %s" ; }
Gets the info format according to the longest worker name.
@param workerInfoList the worker info list to get info from
@param isShort whether exists only one tier
@return the info format for printing long/short worker info