I\'m looking for something like an Array, but it needs to store multiple data types. The Oracle Java tutorials says, \"An array is a container object that holds a fixed numb
You can use an ArrayList
.
ArrayList
And then add items to it.
listOfObjects.add("1");
listOfObjects.add(someObject);
Or create your own object that encapsulates all the field that you require like
public class LocationData {
private double lat;
private double longitude;
public LocationData(double lat, double longitude) {
this.lat = lat;
this.longitude = longitude;
}
//getters
//setters
}
and then add your lat/long pairs to an ArrayList
of type LocationData
ArrayList listOfObjects = new ArrayList();
listOfObjects.add(new LocationData(lat, longitude));