I'm reading the sample chapter from the book "Effective Java" -->http://java.sun.com/...ve/generics.pdf
And i stumbled upon this piece of code:
static <E> E reduce(List<E> list, Function<E> f, E initVal) {
List<E> snapshot;
[B]synchronized(list) {
[/B]snapshot = new ArrayList<E>(list);[B]
}[/B]
E result = initVal;
for (E e : snapshot)
result = f.apply(result, e);
return result;
}I got absolutely no idea what the bold part is doing there. Does anyone knows the name of such a structure so i can at least google for it?:rolleyes:


Sign In
Create Account


Back to top









