public CharSequence format(){
  if (pieces.isEmpty()) {
    return input;
  }
  String target;
  for (  Piece piece : pieces) {
    target=BRACE_START + piece.getKey() + BRACE_END;
    input=input.replace(target,String.valueOf(piece.getValue()));
  }
  return input;
}

public CharSequence format ( ) { if ( pieces . isEmpty ( ) ) { return input ; } String target ; for ( Piece piece : pieces ) { target = BRACE_START + piece . getKey ( ) + BRACE_END ; input = input . replace ( target , String . valueOf ( piece . getValue ( ) ) ) ; } return input ; }
returns formatted charsequence without additional operations
