A query returns a List. This always seemed too broad an
interface for that return value to me.
There are two things that I dare do with the list that is returned:
- iterate over it
- ask for it's size()
A List promises so many things:
- can I modify the list?
- can I check if the list contains an object?
- are there any rules w.r.t. thread access/synchronisation?
- can I compare the list to another list(all objects in Java implement equals)?
Consider contains() for IncrementalFaultList(paged query). It *could*
return false even if the query returned the object. Or rather, if I add
weak references to IncrementalFaultList and do not modify it it
could.
/**
*..ee java.util.Collection#contains(Object)
*/
public boolean contains(Object o) {
synchronized (elements) {
return elements.contains(o);
}
}
The applications I work on use only the Iterable interface,
even if performQuery() returns a List and then only from
a single thread.
-- Øyvind Harboe http://www.zylin.com/zy1000.html ARM7 ARM9 XScale Cortex JTAG debugger and flash programmer
This archive was generated by hypermail 2.0.0 : Fri Jun 20 2008 - 05:08:08 EDT