mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 10:54:51 +00:00
Removed need for manual typecast
This commit is contained in:
@@ -21,6 +21,13 @@ public class AssetManager {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T extends BaseResource> T get(String name) {
|
||||
Asset<T> asset = (Asset<T>) assets.get(name);
|
||||
if (asset == null) return null;
|
||||
return asset.getResource();
|
||||
}
|
||||
|
||||
public static <T extends BaseResource> ArrayList<Asset<T>> getAllOfType(Class<T> type) {
|
||||
ArrayList<Asset<T>> list = new ArrayList<>();
|
||||
for (Asset<? extends BaseResource> asset : assets.values()) { // <-- use .values()
|
||||
|
||||
Reference in New Issue
Block a user