An object-oriented way of solving the problem is to define an Album type that contains all 4 pieces of information pertaining to an album, and have a single array of albums instead of 4 arrays.
Then, you can define comparison on albums as you wish. Here's an example in C# (would be very similar in Java):
class Program {
static void Main(string[] args) {
Album[] albums = { new Album { artist = "potatotes",
family = "soup",
title = "a",
year=1546 },
new Album { artist = "etc",
family="blabla",
title="blablabla",
year = 1999 }
};
Array.Sort(albums);
}
}
class Album : IComparable<Album> {
public int CompareTo(Album y) {
return family.CompareTo(y.family);
}
public string title { get; set; }
public string artist { get; set; }
public int year { get; set; }
public string family { get; set; }
}
Here, we have implemented the IComparable interface in terms of an Album's family. The general idea is to group all related information into a class, and then you can define comparison for objects of that class in terms of one of its fields.
As some might point out, there are more flexible ways to achieve this in C#, but I wanted to keep this as simple and language-agnostic as possible.
This should be possible to replicate as long as the language supports user-defined structures, but I'm not even sure AutoIT supports that. In that case, you'll have to keep your 4 arrays, and implement a custom sort function that sorts one of the arrays and replicates its swap operations on all 3 others at the same time. It's a lot more work though.