On Mon, Feb 3, 2014 at 7:13 AM, Lukasz Lenart <lukaszlen...@apache.org>wrote:
> + String itemKeyStr = StringUtils > + .defaultString(itemKey > == null ? null : itemKey > + > .toString()); > > This is bad as one value was splitted over two lines and it wasn't > because of readability but the default. It'd be better: > > String itemKeyStr = StringUtils.defaultString(itemKey == null ? > null : > > itemKey.toString()); > > Something like that (written by hand) > > + a.add("type", "hidden") > + .add("id", > + > "__multiselect_" > + > + StringUtils > + > .defaultString(StringEscapeUtils > + > .escapeHtml4(id))) > I'd write this as: a.add("type", "hidden") .add("id", "__multiselect_" + defaultString(escapeHtml4(id))); Particularly for well-known APIs I *much* prefer static imports. Here, since things like "building an ID" is common functionality, I'd also likely extract it into its *own* util, leaving: a.add("type", "hidden") .add("id", "__multiselect_" + safeId(id)); * Fits into 80 characters (trivially) * Logic extracted into concise, focused methods If I were doing it across the entire app I might even consider making id builder methods for each type, but meh. I get twitchy when methods start getting over 4-8 lines long and start doing multiple things or have a CC of > 2-4. I'm OCD like that. Dave -- e: davelnew...@gmail.com m: 908-380-8699 s: davelnewton_skype t: @dave_newton <https://twitter.com/dave_newton> b: Bucky Bits <http://buckybits.blogspot.com/> g: davelnewton <https://github.com/davelnewton> so: Dave Newton <http://stackoverflow.com/users/438992/dave-newton>