List<T> () { int count = list.getItemsCount(); List<T> result = new ArrayList<>(count); for (int i = 0; i < count; i++) { T item = list.getItemAt(i); if (item != null) { result.add(item); } } return result; }