The final section of the main
class
displays the results of the
DevInfo
data class data returned in the
sysInfo
object:
List<DevInfo> devList = sysInfo.getDevInfos(); Iterator<DevInfo> devIter = devList.iterator(); while (devIter.hasNext()) { DevInfo devInfo = devIter.next(); System.out.printf("\n"); print("DEVICE", devInfo.getName()); print("DEVICE", devInfo.getVendor()); print("DEVICE", devInfo.getModel()); print("DEVICE", devInfo.getSerial()); print("DEVICE", devInfo.getCapacity()); }
Unlike the General
data class which contains
a single set of attributes, the
DevInfo
object is actually a
Java List
of
DevInfo
objects.
This is because there are usually multiple devices on a system where-as
there is usually only a single hostname as found in the
General
data class.