On Tue, Dec 16, 2008 at 2:57 AM, cretzel <[email protected]> wrote:
>
> Wouldn't you care about the performance of List.indexOf()?

i certainly would if it showed up as a hotspot in the profiler.

-igor


> What about using
> just the index as a parameter instead of the adress? That would imply a
> different IDataProvider like this:
>
>    public AdressDataProvider(IModel customerModel) {
>        this.customerModel = customerModel;
>    }
>
>    public Iterator<?> iterator(final int first, final int count) {
>        return new Iterator<Integer>() {
>            private int i;
>
>            public boolean hasNext() {
>                return i < first + count;
>            }
>
>            public Integer next() {
>                return i++;
>            }
>
>            public void remove() {
>
>            }
>        };
>    }
>
>    public IModel model(final Object object) {
>        final Integer index = (Integer) object;
>        return new AdressModel(customerModel, index);
>    }
>
> Although kind of weird, this way you would not have to determine the index
> by calling indexOf().
> What do you think?
>
> By the way, is there a shorter way of getting an iterator over an Integer
> range?
>
> --
> View this message in context: 
> http://www.nabble.com/IDataProvider-LoadableDetachableModel-for-indexed-lists-tp21011916p21031001.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to