Java List Single Value singleValue(List l)

Here you can find the source of singleValue(List l)

Description

single Value

License

Open Source License

Declaration

public static <T> T singleValue(List l) 

Method Source Code

//package com.java2s;
// modify it under the terms of the GNU General Public License

import java.util.List;

public class Main {
    public static <T> T singleValue(List l) {
        if (l == null || l.isEmpty())
            return null;
        else//from w  w  w.j a  va 2 s.  co  m
            return (T) l.get(0);
    }
}

Related

  1. singleQuoatanizeStringList(List entries)
  2. singletonList(final T source)
  3. singletonList(T element)
  4. singletonListIfNotNullOrEmptyListIfNull(T element)
  5. singleValue(Class type, List values)
  6. singleValue(List values)