I have a List with Object[] inside and I want to access a value of one of the Objects[]. This is how my code looks:
private List<Object> trackList;
trackList = new ArrayList<>();
Integer random = (int)(Math.random() * ((100 - 0) + 1)) + 0;
Integer random2 = (int)(Math.random() * ((100 - 0) + 1)) + 0;
Object[] currTrack = new Object[]{random1, random2};
trackList.add(currTrack);
Integer value1 = trackList.get(0)[1];
Getting: "Array type expected; found:'java.lang.object'
I think I am missing something very simple. Help would be great, thanks.
trackListasList<int[]>andcurrTrackasint[]?Object[]or at least it's not type as a list of arrays ... and not using typed arrays and lists, likeint[]andList[int[]]is weird in my opinion.