(final ItemPool<Tin> from, final Class<Tout> clsHint)
| 44 | } |
| 45 | |
| 46 | @SuppressWarnings("unchecked") |
| 47 | public static <Tin extends InventoryItem, Tout extends InventoryItem> ItemPool<Tout> createFrom(final ItemPool<Tin> from, final Class<Tout> clsHint) { |
| 48 | final ItemPool<Tout> result = new ItemPool<>(clsHint); |
| 49 | if (from != null) { |
| 50 | for (final Entry<Tin, Integer> e : from) { |
| 51 | final Tin srcKey = e.getKey(); |
| 52 | if (clsHint.isInstance(srcKey)) { |
| 53 | result.add((Tout) srcKey, e.getValue()); |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | return result; |
| 58 | } |
| 59 | |
| 60 | @SuppressWarnings("unchecked") |
| 61 | public static <Tin extends InventoryItem, Tout extends InventoryItem> ItemPool<Tout> createFrom(final Iterable<Tin> from, final Class<Tout> clsHint) { |
no test coverage detected