use of android.support.v4.util.LongSparseArray in project SeriesGuide by UweTrottmann.
the class CalendarAdapter method generateHeaderList.
protected List<HeaderData> generateHeaderList() {
int count = getCount();
if (count == 0 || !mIsShowingHeaders) {
return null;
}
// pre-size to 30 as we display 30 days == headers at most
LongSparseArray<HeaderData> mapping = new LongSparseArray<>(30);
List<HeaderData> headers = new ArrayList<>();
for (int position = 0; position < count; position++) {
long headerId = getHeaderId(position);
HeaderData headerData = mapping.get(headerId);
if (headerData == null) {
headerData = new HeaderData(position);
headers.add(headerData);
}
headerData.incrementCount();
mapping.put(headerId, headerData);
}
return headers;
}
Aggregations