Solve: Last In List
Created By: Geoffrey Challen
/ Version: 2022.7.0
Write a method named lastInList that accepts a single List<?> of items and returns the last element as an
Object.
The list will contain at least one element.
Don't overthink this!
The solution is a single line of code.
For this problem we're expecting only a method.Don't define a class, include modifiers like static or public, add import statements, or add code outside the method declaration.You may use the following packages for this problem without importing them: java.util.List