commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <>
Subject [collections] new sublist type?
Date Tue, 29 Nov 2005 10:33:25 GMT

I'd like opinions on adding a new collection type which represents a
"sublist" of some larger list of data.

  public interface Sublist {
    public int getStartOffset();
    public int getDatasetSize();
    public List getSublistData();

Where getSublistData() is a list of elements from some "complete"
dataset. Property datasetSize is the size of the complete set, not the
size of the sublist.

Note that I'm talking here about situations where the "complete" dataset
cannot be loaded into memory due to size. Typically the data is stored
within a database.

The use case for this is as follows:
 The presentation tier of an application wants to allow a user
 to view a *large* set of available data one "page" at a time. 
 It needs to know the full size of the available data

 The business level of the application therefore needs to be
 able to return some collection representing a "sublist" of
 the available data.

In particular, I've struck this need when writing an application using
JSF [myfaces] and EJB3. I'd like to add a generic component to the
MyFaces library which can handle paginated data. However the "sublist"
type returned by the EJBs shouldn't be a type from the MyFaces library;
that would be very bad style. A "sublist" type available from the
commons-collections library would form an excellent "bridge" between the
two worlds (business and presentation).




To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message