Дженериковые массивы создаются чуть более правильным образом
This commit is contained in:
parent
fdd140a179
commit
89ab094b5b
@ -1,15 +1,16 @@
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.Random;
|
||||
|
||||
public class EntityWithExtraCreator <T extends EntityLocomotive, U extends IDrawningExtra> {
|
||||
private EntityLocomotive[] entityArr;
|
||||
private IDrawningExtra[] extraArr;
|
||||
private T[] entityArr;
|
||||
private U[] extraArr;
|
||||
|
||||
int entitiesCount = 0;
|
||||
int extraCount = 0;
|
||||
|
||||
public EntityWithExtraCreator(int countEntities, int countExtra) {
|
||||
entityArr = new EntityLocomotive[countEntities];
|
||||
extraArr = new IDrawningExtra[countExtra];
|
||||
entityArr = (T[]) new EntityLocomotive[countEntities];
|
||||
extraArr = (U[]) new IDrawningExtra[countExtra];
|
||||
}
|
||||
|
||||
public int Insert(T entityLocomotive) {
|
||||
|
Loading…
Reference in New Issue
Block a user