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.List;

import java.util.NoSuchElementException;

public class Main {
    public static <T> T fourth(List<T> list) {
        if (list.size() < 4) {
            throw new NoSuchElementException("Collection does not have a enough elements");
        }
        return list.get(3);
    }
}