Java List Last Item getLast(List list)

Here you can find the source of getLast(List list)

Description

get Last

License

Apache License

Declaration

public static <T> T getLast(List<T> list) 

Method Source Code


//package com.java2s;
/*/*from w  w w  .  j  a va2s  . c om*/
 * Commons-Utils
 * Copyright (c) 2017.
 *
 * Licensed under the Apache License, Version 2.0 (the "License")
 */

import java.util.*;

public class Main {

    public static <T> T getLast(List<T> list) {
        if (isEmpty(list)) {
            return null;
        }

        return list.get(list.size() - 1);
    }

    public static boolean isEmpty(List<?> list) {
        return (list == null) || (list.isEmpty());
    }
}

Related

  1. getLast(List list)
  2. getLast(List aList)
  3. getLast(List elements)
  4. getLast(List items)
  5. getLast(List l)
  6. getLast(List list)
  7. getLast(List list)
  8. getLast(List list)
  9. getLast(List list)