- strength and limitations of for each loop (for( : ))
http://today.java.net/article/2006/11/03/nuances-java-50-each-loop - Loading properties/configurationfiles
- Java 5 New Features
http://java.sun.com/j2se/1.5.0/docs/relnotes/features.html
http://java.sun.com/developer/technicalArticles/releases/j2se15/
http://download.oracle.com/javase/1.5.0/docs/guide/language/index.html - Increase Java Performance
http://java.sun.com/developer/technicalArticles/Programming/Performance/ - Java Language Best Practices
http://docs.oracle.com/cd/A97688_16/generic.903/bp/java.htm - Code Conventions for the Java Programming Language
http://www.oracle.com/technetwork/java/codeconv-138413.html - ThreadLocal - http://java.dzone.com/articles/java-thread-local-%E2%80%93-how-use
- String Concatenation
- use plus operator(+) only if all operands are constants1) String temp = “alpha” + “beta”; '-> String temp = “alphabeta”; (compile time translation) 2) String temp = x + “beta”; '-> String temp = (new StringBuilder()).append(x).append(“beta”).toString();
- concat using plus operator uses StringBuilder and String behind the scenes:“alpha” + “beta” = new StringBuilder(String.toString(“alpha”)).append(“beta”).toString()
- use String.concat if concatenating only 2 or few strings
- use StringBuilder(unsynchronized)/StringBuffer(synchronized) for more than 2 strings, specially in a loop
- in a loop, SB is better than concat is better than +
- always initialize SB with initial capacity to greatly improve performancenew SB() has 16 char initial capacity by default
- best explanation is here: http://www.znetdevelopment.com/blogs/2009/04/06/java-string-concatenation/ - character set conversion
String stringToConvert = bmText; byte[] convertStringToByte = stringToConvert.getBytes("UTF-8"); bmText = new String(convertStringToByte, "ISO-8859-1"); options.add(new SelectOption(bmValue, new String(bmText)));
public void doHeader() throws Exception { Image logoImage = PDFUO.getLogoImage(); //logoImage.setAbsolutePosition(ReportConstantsIF.ITEXT_POINTS/2, length - ReportConstantsIF.ITEXT_POINTS); logoImage.setAlignment(Image.ALIGN_TOP | Image.TEXTWRAP); Paragraph p = new Paragraph(); p.add(logoImage); p.add(new Phrase("BEAR, STEARNS SECURITIES CORP." + "\n\n", new Font(Font.TIMES_ROMAN, 6, Font.BOLD))); p.add(new Phrase( "ONE METROTECH CENTER NORTH" + "\n" + "BROOKLYN, NEW YORK 11201-3859" + "\n" + "(212) 272-1000", smallFont)); p.setLeading(9f); HeaderFooter header = new HeaderFooter(p, false); header.setAlignment(Element.ALIGN_RIGHT); header.setBorder(PdfTable.NO_BORDER); document.setHeader(header); }
-error occurs and data is not displayed when the columns in a row is not complete in PdfPTable
No comments:
Post a Comment