I had a remark about a piece of code in the style of:
Iterable upperCaseNames = Iterables.transform(
lowerCaseNames, new Function
Short answer: No - don't worry.
Long answer: it depends how frequently you're instantiating it. If in a frequently-called tight loop, maybe - though note that when the function is applied it calls String.toUpperCase()
once for every item in an Iterable
- each call presumably creates a new String
, which will create far more GC churn.
"Premature optimization is the root of all evil" - Knuth