But sometimes, you really want a boring old ArrayList instead of an
ImmutableList.
I'm not finding a clean and short way to do this.
I've got code such as:
Iterable<Calendar> itHour = Iterables.filter(recentProcessed,
new Predicate<Calendar> () {
public boolean apply(Calendar cal) {
long delta = Calendar.getInstance
(Constants.utcTZ).getTimeInMillis() - cal.getTimeInMillis();
return delta/Constants.SECONDS_PER_HOUR == 0;
}
});
processedHour = new ArrayList<Calendar>();
for (Calendar c : itHour) {
processedHour.add(c);
}
Anybody got a better solution, something that will accept the
Iterable<> and turn it into a writable list/map/set.
Thanks
Pat
--
Google Collections Library - users list
http://groups.google.com/group/google-collections-dev?hl=en
To unsubscribe, send email to:
google-collections...@googlegroups.com
Thanks, that is just what I was looking for.
I didn't know about the TimeUnit.HOURS.toSeconds(1), using it means I
get to kill some of my local magic constants. Thanks again
I have the strange suspicion that Kevin is face-palming maniacly when
he hears that one :)
So is there an inside story here you can share? Did he fight for them
against big odds? Did he argue that no one would understand them, let
alone use them?
I've almost got my PointyHairedBoss using them. Mostly because I'm
using them everywhere, they fit wonderfully into the app that I'm
writing.