### Question:
Inventory implements Serializable, Cloneable, List<ItemStack> { @Override public int lastIndexOf(Object o) { for (int i = size() - 1; i > -1; i--) { ItemStack item = get(i); if (item == null) { continue; } if (item.equals(o) || item.getMaterial().equals(o)) { return i; } } return -1; } Inventory(int size);  Inventory(ItemStack... contents); ItemStack[] getContents(); Set<InventoryViewer> getViewers(); boolean addViewer(InventoryViewer viewer); boolean removeViewer(InventoryViewer viewer); void setData(int slot, int data); boolean addData(int slot, int data); void setAmount(int slot, int amount); boolean addAmount(int slot, int amount); int getAmount(Material material); void onSlotChanged(int slot, ItemStack newItem, ItemStack previous); void update(int slot, ItemStack previous); void updateAll(); Grid grid(int length); Cube cube(int length, int height); boolean contains(Material material, int amount); boolean containsExactly(Material material, int amount); void add(int firstSlot, int lastSlot, ItemStack item); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); boolean contains(Material material); boolean contains(ItemStack item); @Override InventoryIterator iterator(); @Override Object[] toArray(); @SuppressWarnings ("unchecked") @Override T[] toArray(T[] a); @Override boolean add(ItemStack item); @Override boolean remove(Object o); @Override boolean containsAll(Collection<?> objects); @Override boolean addAll(Collection<? extends ItemStack> items); @Override boolean addAll(int i, Collection<? extends ItemStack> items); @Override boolean removeAll(Collection<?> objects); @Override boolean retainAll(Collection<?> objects); @Override void clear(); @Override ItemStack get(int i); boolean canSet(int i, ItemStack item); ItemStack set(int i, ItemStack item, boolean update); @Override ItemStack set(int i, ItemStack item); @Override void add(int i, ItemStack item); @Override ItemStack remove(int i); Slot getFirstEmptySlot(); Slot getFirstUsedSlot(); @Override int indexOf(Object o); @Override int lastIndexOf(Object o); @Override InventoryIterator listIterator(); @Override InventoryIterator listIterator(int i); @Override Inventory subList(int firstSlot, int lastSlot); @Override Inventory clone(); @Override int hashCode(); @Override boolean equals(Object obj);  }### Answer:
@Test public void testLastIndexOf() { ItemStack item = getRandomItem(); inventory.set(0, item); inventory.set(19, item); assertEquals(19, inventory.lastIndexOf(item)); }