本文翻译自:How to get the last value of an ArrayList
How can I get the last value of an ArrayList? 如何获取ArrayList的最后一个值?
I don't know the last index of the ArrayList. 我不知道ArrayList的最后一个索引。
#1楼
参考:https://stackoom.com/question/2sw5/如何获取ArrayList的最后一个值
#2楼
There isn't an elegant way in vanilla Java. 在香草Java中没有一种优雅的方式。
Google Guava 谷歌番石榴
The Google Guava library is great - check out their Iterables
class . Google Guava库很棒 - 查看他们的Iterables
类 。 This method will throw a