I have a readData()
function that reads files a returns a few different objects of parsed data. Right now, the return type of readData()
is Object[]
:
Object[] data = readData();
MyGenome genome = data[0];
Species[] breeds = data[1];
//etc
This feels awkward. Is there a better way to return this data? I don't want to have separate functions like readGenome()
and readSpecies()
because that would require iterating over the files twice. Also, I'd rather wrap up all the gathering of data in one function.
A similar issue: a function that returns a match of at least four characters between two strings:
public int[][] findMatch(String g0, String g1) { /* cool stuff */ }
//...
int[][] bounds = findMatch("ACOIICOCOCICOICA", "AOCCCCCCICCIIIIIOIAOCICOICOICA");
where bounds[0][0]
is the left bound on the g0, bounds[0][1]
is the right bound on g0, bounds[1][0]
is the left bound on g1, etc. This also feels sort of awkward. It is difficult to code with the result without continuously looking up the keys.