Java List to Long Number Array toLongList(List stringList)

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

Description

Converts the specified list of Strings to the list of Longs.

License

MIT License

Parameter

Parameter Description
stringList a String list.

Return

the Long list.

Declaration

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

Method Source Code

//package com.java2s;
/*//from  ww w. j  a  v  a 2 s .  c  o  m
 * Copyright (c) 2013-2017 QuartzDesk.com.
 * Licensed under the MIT license (https://opensource.org/licenses/MIT).
 */

import java.util.ArrayList;

import java.util.List;

public class Main {
    /**
     * Converts the specified list of Strings to the list of Longs.
     *
     * @param stringList a String list.
     * @return the Long list.
     */
    public static List<Long> toLongList(List<String> stringList) {
        List<Long> longList = new ArrayList<Long>(stringList.size());
        for (String s : stringList) {
            longList.add(new Long(s));
        }
        return longList;
    }
}

Related

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