我有个问题。如何检查哪个列表最大且元素最多。我有 10 个列表,但其中一些可能为空。如何检查哪个列表最大并防止为空?这就是我所拥有的:
if(listOfPressureDataToPlot!=null &&listOfPressureDataToPlot.size()>=listOfDBPDataToPlot.size()&& listOfPressureDataToPlot.size()>=listOfSBPDataToPlot.size()&& listOfPressureDataToPlot.size()>=listOfTempDataToPlot.size()&&
listOfPressureDataToPlot.size()>=listOfBIODataToPlot.size()&& listOfPressureDataToPlot.size()>=listOfCENDataToPlot.size()&& listOfPressureDataToPlot.size()>=listOfGLUDataToPlot.size()&&
listOfPressureDataToPlot.size()>=listOfHBDDataToPlot.size()&& listOfPressureDataToPlot.size()>=listOfOBBDataToPlot.size()&& listOfPressureDataToPlot.size()>=listOfOBGDataToPlot.size()&&
listOfPressureDataToPlot.size()>=listOfOBKDataToPlot.size()&& listOfPressureDataToPlot.size()>=listOfRANDataToPlot.size()&& listOfPressureDataToPlot.size()>=listOfTALDataToPlot.size()&&
listOfPressureDataToPlot.size()>=listOfWAGDataToPlot.size()&& listOfPressureDataToPlot.size()>=listOfWZRDataToPlot.size()){
dateValue = checkDateToPopUp(listOfPressureDataToPlot, listOfPressureToPlot, x1).getFirst();
setMexTable(listOfPressureDataToPlot);
}
但是如果此列表之一为空,则此解决方案不会保护我。如何实现简单的代码来检查哪个列表包含最多的元素?