"While digging through some database code in our system," Paul L wrote in, "I noticed an interesting pattern emerge. Whenever a boolean value within a SQL result was checked, it would look something like this..."
if (result != null && result.toUpperCase.equals(OurBoolean.TRUE)) { ... }
"And although OurBoolean lacks a FILE_NOT_FOUND parameter, it does optimize for performance and memory usage through lazy list initialization."
package com.initrodeglobal.db.utils; import java.util.List; import java.util.ArrayList; public class OurBoolean { public static final String TRUE = "TRUE"; public static final String FALSE = "FALSE"; private static List list = null; public static List getList() { if(list == null) { list = new ArrayList(); list.add(TRUE); list.add(FALSE); } return list; } }
[Advertisement]
BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!