Op 11/02/2011 18:05, Michael Niedermair schreef:
> Hi Bruno,
>
> I have a suggestion about Paragraph and Phrase.
> It were nice, if a new Constructor exists, which set the init size of 
> the ArrayList.

This is a suggestion that should be posted to the mailing list. 
Personally, I don't see the value of such an extra constructor. When I 
use Phrase or Paragraph, there's absolutely no way to know the size of 
the List in advance. If you have a controlled environment where you do, 
you could extend the classes and use that specific subclass.
>
> e.g.
> public Paragraph(int initialCapacity) {
>    super(initialCapacity));
> }
>
> public Phrase(int initialCapacity) {
>    super(initialCapacity));
> }
>
> // change
> public Phrase() {
>         this(16.0f);
> }
>
> The problem is, that the default init size is 10. Each time, I arrive 
> the limit, the size is increasing.
>
> newCapacity = (oldCapacity * 3)/2 + 1
> elementData = Arrays.copyOf(elementData, newCapacity);
>
> 10 .. copy array,
> 16 ..  copy array
> 25 .. copy array
> 38 .. copy array
> 58 .. copy array
> an so on.
>
> If I add a lot of text (e.g. from a file, line by line) the arraylist 
> copy the array and copy the array and so on.
> The init size set by the user can solve the problem with array copy.
>
> By
> Michael
>
>
>
>


------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to