This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Stack<T>{ | |
val elements: MutableList<T> = mutableListOf() | |
fun isEmpty() = elements.isEmpty() | |
fun count() = elements.size | |
fun push(item: T) = elements.add(item) | |
fun pop() : T? { | |
val item = elements.lastOrNull() | |
if (!isEmpty()){ | |
elements.removeAt(elements.size -1) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.time.*; | |
import java.time.format.DateTimeFormatter; | |
import java.time.format.FormatStyle; | |
import java.time.temporal.ChronoUnit; | |
import java.time.temporal.TemporalAdjusters; | |
import java.util.*; | |
import static java.time.temporal.TemporalAdjusters.*; | |
public class Java8DateTimeExamples { |