Java ArrayList - Check if list is empty

前端 未结 6 875
小蘑菇
小蘑菇 2020-12-05 13:00

How can I check if a list is empty? If so, the system has to give a message saying List is empty. If not, the system has to give a message saying Li

6条回答
  •  一生所求
    2020-12-05 13:17

    Good practice nowadays is to use CollectionUtils from either Apache Commons or Spring Framework.

    CollectionUtils.isEmpty(list))
    

提交回复
热议问题