quinta-feira, 13 de março de 2014

Java Dynamic ArrayList Examples

1. Introduction

This post only gather some references and examples of use of ArrayList in Java


2. Examples


  • Example #1:


List elementList = new ArrayList();
for (int i = 0; i < nodeList.getLength(); i++) {
Element element = (Element) (Node) nodeList.item(i);
if (element.getAttribute(attribute).equals(attributeValue)) {
elementList.add(element);
}
}

  • Example #2:


ArrayList<CellStyle> listCellStyle = new ArrayList<CellStyle>();
// i=0: LEMON_CHIFFON
style = workbook.createCellStyle();
style.setFillForegroundColor(IndexedColors.LEMON_CHIFFON.getIndex());
style.setFillPattern(CellStyle.SOLID_FOREGROUND);
listCellStyle.add(style);





3. References


Nenhum comentário:

Postar um comentário