Skip to content

Commit

Permalink
Release 5.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
davideas committed Mar 4, 2018
1 parent ed86e5a commit f5542c3
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ public void updateDataSet(@Nullable List<T> items, boolean animate) {
}

/**
* Returns the object of type <b>T</b>.
* Returns the object of the generic type <b>T</b>.
* <p>This method cannot be overridden since the entire library relies on it.</p>
*
* @param position the position of the item in the list
Expand All @@ -633,6 +633,20 @@ public T getItem(int position) {
return mItems.get(position);
}

/**
* Returns the object of specific type <b>S</b>.
*
* @param position the position of the item in the list
* @param clazz the class type expected
* @return The <b>S</b> object for the position provided or null if item not found
* @throws ClassCastException if the class type doesn't match with the item type requested
* @since 5.0.0
*/
@Nullable
public <S extends T> S getItem(int position, Class<S> clazz) {
return clazz.cast(getItem(position));
}

/**
* This method is mostly used by the adapter if items have stableIds.
*
Expand Down Expand Up @@ -3825,8 +3839,11 @@ public void setFilter(@Nullable Serializable filter) {
}

/**
* Gets the current filter.
*
* @param clazz The class type of filter to return (eg. String.class)
* @return the current filter entity
* @throws ClassCastException if the class type doesn't match with the filter type previously set
* @since 5.0.0
*/
@Nullable
Expand Down

0 comments on commit f5542c3

Please sign in to comment.