Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.util.Collection;

import java.util.Stack;

public class Main {
    public static <E> E peekOrNull(final Stack<? extends E> stack) {
        return !isEmpty(stack) ? stack.peek() : null;
    }

    public static boolean isEmpty(final Collection<?> collection) {
        return (collection == null) || collection.isEmpty();
    }
}