/** * Invoked to convert a set into a List. * * @param set * a set (which may be empty or null) * @return a list (possibly empty) of the items in the set */ protected List convertSetToList(Set set) { if (Tapestry.isEmpty(set)) return Collections.EMPTY_LIST; return new ArrayList(set); }
/** * Invoked to convert a set into a List. * * @param set * a set (which may be empty or null) * @return a list (possibly empty) of the items in the set */ protected List convertSetToList(Set set) { if (Tapestry.isEmpty(set)) return Collections.EMPTY_LIST; return new ArrayList(set); }
/** * Converts a {@link Map} to an even-sized array of key/value pairs. This may be useful when * using a Map as service parameters (with {@link org.apache.tapestry.link.DirectLink}. * Assuming the keys and values are simple objects (String, Boolean, Integer, etc.), then the * representation as an array will encode more efficiently (via * {@link org.apache.tapestry.util.io.DataSqueezerImpl} than serializing the Map and its * contents. * * @return the array of keys and values, or null if the input Map is null or empty * @since 2.2 */ public static Object[] convertMapToArray(Map map) { if (isEmpty(map)) return null; Set entries = map.entrySet(); Object[] result = new Object[2 * entries.size()]; int x = 0; Iterator i = entries.iterator(); while (i.hasNext()) { Map.Entry entry = (Map.Entry) i.next(); result[x++] = entry.getKey(); result[x++] = entry.getValue(); } return result; }
/** * Converts a {@link Map} to an even-sized array of key/value pairs. This may be useful when * using a Map as service parameters (with {@link org.apache.tapestry.link.DirectLink}. * Assuming the keys and values are simple objects (String, Boolean, Integer, etc.), then the * representation as an array will encode more efficiently (via * {@link org.apache.tapestry.util.io.DataSqueezerImpl} than serializing the Map and its * contents. * * @return the array of keys and values, or null if the input Map is null or empty * @since 2.2 */ public static Object[] convertMapToArray(Map map) { if (isEmpty(map)) return null; Set entries = map.entrySet(); Object[] result = new Object[2 * entries.size()]; int x = 0; Iterator i = entries.iterator(); while (i.hasNext()) { Map.Entry entry = (Map.Entry) i.next(); result[x++] = entry.getKey(); result[x++] = entry.getValue(); } return result; }
if (!Tapestry.isEmpty(_externalScripts)) writeExternalScripts(writer, cycle);
if (!Tapestry.isEmpty(_externalScripts)) writeExternalScripts(writer, cycle);