Java List to Long Number Array toLongList(List members)

Here you can find the source of toLongList(List members)

Description

to Long List

License

Apache License

Declaration

public static List<Long> toLongList(List<String> members) 

Method Source Code


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

import java.util.ArrayList;

import java.util.Iterator;

import java.util.List;

public class Main {

    public static List<Long> toLongList(List<String> members) {
        if (isEmpty(members)) {
            return null;
        }//w ww  . j a  v a 2s.c om
        List<Long> result = new ArrayList<Long>();
        Iterator<String> iterator = members.iterator();
        while (iterator.hasNext()) {
            String str = iterator.next();
            if (str == null) {
                result.add(null);
            } else {
                long member = Long.parseLong(str);
                result.add(member);
            }
        }
        return result;
    }

    public static boolean isEmpty(List<?> list) {
        if (list == null || list.isEmpty()) {
            return true;
        } else {
            return false;
        }
    }
}

Related

  1. toLongArray(List list)
  2. toLongArray(List list)
  3. toLongArray(List list)
  4. toLongArray(List list)
  5. toLongArray(List values)
  6. toLongList(List stringList)
  7. toLongList(Set set)