org.dellroad.stuff.vaadin7.SimpleQueryList Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dellroad-stuff-vaadin7 Show documentation
Show all versions of dellroad-stuff-vaadin7 Show documentation
DellRoad Stuff classes related to the Vaadin GUI framework.
The newest version!
/*
* Copyright (C) 2022 Archie L. Cobbs. All rights reserved.
*/
package org.dellroad.stuff.vaadin7;
import java.util.List;
/**
* Simple {@link QueryList} implementation using a normal {@link List}.
*
* @see AbstractQueryContainer
*/
public class SimpleQueryList implements QueryList {
private final List extends T> list;
/**
* Constructor.
*
* @param list backing list
* @throws IllegalArgumentException if {@code list} is null
*/
public SimpleQueryList(List extends T> list) {
if (list == null)
throw new IllegalArgumentException("null list");
this.list = list;
}
@Override
public long size() {
return this.list.size();
}
@Override
public T get(long index) {
if (index > Integer.MAX_VALUE || index < Integer.MIN_VALUE)
throw new IndexOutOfBoundsException("index = " + index);
return this.list.get((int)index);
}
}