====== list에서_마지막_요소_얻는_방법 ======
* description :
* author : 도봉산핵주먹
* email : hylee@repia.com
* lastupdate : 2020-03-25
===== 코드 예시 =====
public void calDateBetweenAandB()
import java.util.Arrays;
import java.util.List;
public class ListLastElement {
public static void main(String[] argv){
List list = Arrays.asList( "A", "B", "C", "D" );
String lastElement = null;
if( !list.isEmpty() )
lastElement = list.get(list.size() - 1);
System.out.print( "The last element is " + lastElement);
}
}
===== 중요 코드 =====
list.get(list.size() - 1)
===== 결과 출력 =====
The last element is D
===== Ref =====
* [[http://oliviertech.com/ko/java/how-to-get-the-last-element-in-a-list-in-java/|list에서_마지막_요소_얻는_방법]]
{{tag>도봉산핵주먹 java List마지막요소}}