ArrayList e iText - erro ao escrever parágrafo

Olá pessoal, estou com um problema aqui na hora de escrever um parágrafo em um PDF com o iText.
O código é esse:

ArrayList ListaDeQuestoes = new ArrayList(); String pronto = "olá"; ListaDeQuestoes.add(pronto); String cder = (String) ListaDeQuestoes.get(0); // TEM PROBLEMA documento.add(new Paragraph(cder));

Fiz alguns testes e concluí que na linha onde diz // TEM PROBLEMA da o erro:

Gostaria de saber qual é o problema que está acontecendo, alguém me ajuda?

Obrigado comunidade

Aqui isso não deu erro…

E realmente não poderia dar erro, você adicionou a variável do tipo String à lista, portanto ela está lá!

ArrayList ListaDeQuestoes = new ArrayList(); String pronto = "olá"; ListaDeQuestoes.add(pronto); System.out.println((String) ListaDeQuestoes.get(0));
Vai depender do contexto onde isso se encontra, veja um trecho do JavaDoc do ArrayList…

[code]/**

  • Note that this implementation is not synchronized.

  • If multiple threads access an ArrayList instance concurrently,
  • and at least one of the threads modifies the list structurally, it
  • must be synchronized externally. (A structural modification is
  • any operation that adds or deletes one or more elements, or explicitly
  • resizes the backing array; merely setting the value of an element is not
  • a structural modification.) This is typically accomplished by
  • synchronizing on some object that naturally encapsulates the list.*/[/code]

[quote=alexcostars]Olá pessoal, estou com um problema aqui na hora de escrever um parágrafo em um PDF com o iText.
O código é esse:

ArrayList ListaDeQuestoes = new ArrayList(); String pronto = "olá"; ListaDeQuestoes.add(pronto); String cder = (String) ListaDeQuestoes.get(0); // TEM PROBLEMA documento.add(new Paragraph(cder));

Fiz alguns testes e concluí que na linha onde diz // TEM PROBLEMA da o erro:

Gostaria de saber qual é o problema que está acontecendo, alguém me ajuda?

Obrigado comunidade
[/quote]

vlw pela ajuda, vou tentar mudar a lógica, quem sabe é isso.