public boolean apply(Context context) {

		Map<String, Object> bindings = context.getBinding();
		final Iterable<?> iterable = evaluator.evaluateIterable(
				collectionExpression, bindings);
		boolean first = true;
		applyOpen(context);
		int i = 0;
		for (Object o : iterable) {
			Context oldContext = context;
			if (first) {
				context = new PrefixedContext(context, "");
			} else {
				if (separator != null) {
					context = new PrefixedContext(context, separator);
				} else {
					context = new PrefixedContext(context, "");
				}
			}
			int uniqueNumber = context.getUniqueNumber();
			if (o instanceof Map.Entry) { // Issue #709
				@SuppressWarnings("unchecked")
				Map.Entry<Object, Object> mapEntry = (Map.Entry<Object, Object>) o;
				applyIndex(context, mapEntry.getKey(), uniqueNumber);
				applyItem(context, mapEntry.getValue(), uniqueNumber);
			} else {
				applyIndex(context, i, uniqueNumber);
				applyItem(context, o, uniqueNumber);
			}
			contents.apply(new FilteredContext(context, index, item,
					uniqueNumber));
			if (first)
				first = !((PrefixedContext) context).isPrefixApplied();
			context = oldContext;
			i++;
		}
		applyClose(context);
		return true;
	}