Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/**
 * Aptana Studio
 * Copyright (c) 2005-2011 by Appcelerator, Inc. All Rights Reserved.
 * Licensed under the terms of the GNU Public License (GPL) v3 (with exceptions).
 * Please see the license.html included with this distribution for details.
 * Any modifications to this file must keep this entire header intact.
 */

import java.util.Collections;

import java.util.List;

public class Main {
    /**
     * This is a convenience method that essentially checks for a null list and returns Collections.emptyList in that
     * case. If the list is non-null, then this is an identity function.
     * 
     * @param <T>
     * @param list
     * @return
     */
    public static <T> List<T> getListValue(List<T> list) {
        if (list == null) {
            return Collections.emptyList();
        }

        return list;
    }
}