Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #25369

Re: StringBuilder.append and CharSequence

From Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at>
Newsgroups comp.lang.java.programmer
Subject Re: StringBuilder.append and CharSequence
Date 2013-09-27 12:52 +0000
Organization A noiseless patient Spider
Message-ID <slrnl4avs3.mol.avl@gamma.logic.tuwien.ac.at> (permalink)
References (1 earlier) <52438692$0$292$14726298@news.sunsite.dk> <slrnl48tkb.mol.avl@gamma.logic.tuwien.ac.at> <52448f70$0$303$14726298@news.sunsite.dk> <slrnl497c6.mol.avl@gamma.logic.tuwien.ac.at> <5244a015$0$302$14726298@news.sunsite.dk>

Show all headers | View raw


Arne Vajhøj <arne@vajhoej.dk> wrote:
> And why not call .toString explicit? Is the code that
> performance critical?

I'm not optimizing for performance, but I'm always - from the
first line of code that I write - optimizing for a property
that I'd call "don't do goofy stuff."

To me, creating a CharSequence(implementation) instance that wraps
the length and the char, is NOT goofy.

Otoh, creating a temporary object (be it String or char[]) that
holds the given number of copies of a single char IS goofy in my
vocabulary.

If a CharSequence is a vehicle to transport the char and the number
into StringBuilder's reach, then this is some big boilerplate substitute
for the sorely missing .append(int num, char ch) method, but not goofy.

If this CharSequence was then merely used to create a big dull
temp object via toString(), then it goes right back to "goofy".

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

StringBuilder.append and CharSequence Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2013-09-25 14:19 +0000
  Re: StringBuilder.append and CharSequence markspace <markspace@nospam.nospam> - 2013-09-25 13:02 -0700
    Re: StringBuilder.append and CharSequence markspace <markspace@nospam.nospam> - 2013-09-25 18:34 -0700
      Re: StringBuilder.append and CharSequence Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2013-09-26 17:37 +0000
        Re: StringBuilder.append and CharSequence Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2013-09-26 23:11 +0200
          Re: StringBuilder.append and CharSequence Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2013-09-27 13:30 +0000
            Re: StringBuilder.append and CharSequence Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2013-09-27 19:31 +0200
              Re: StringBuilder.append and CharSequence markspace <markspace@nospam.nospam> - 2013-09-27 13:45 -0700
                Re: StringBuilder.append and CharSequence Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2013-09-27 23:16 +0000
                Re: StringBuilder.append and CharSequence Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2013-09-29 04:58 +0200
                Re: StringBuilder.append and CharSequence Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2013-09-30 20:02 +0000
  Re: StringBuilder.append and CharSequence Arne Vajhøj <arne@vajhoej.dk> - 2013-09-25 20:57 -0400
    Re: StringBuilder.append and CharSequence Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2013-09-26 18:01 +0000
      Re: StringBuilder.append and CharSequence Arne Vajhøj <arne@vajhoej.dk> - 2013-09-26 15:47 -0400
        Re: StringBuilder.append and CharSequence Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2013-09-26 20:48 +0000
          Re: StringBuilder.append and CharSequence Arne Vajhøj <arne@vajhoej.dk> - 2013-09-26 16:58 -0400
            Re: StringBuilder.append and CharSequence Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2013-09-27 12:52 +0000
              Re: StringBuilder.append and CharSequence Arne Vajhøj <arne@vajhoej.dk> - 2013-10-04 20:59 -0400
                Re: StringBuilder.append and CharSequence Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2013-10-05 12:51 +0000
  Re: StringBuilder.append and CharSequence Sven Köhler <remove-sven.koehler@gmail.com> - 2013-09-27 15:41 +0300

csiph-web