Java List to Int List toIntegers(final List longs)

Here you can find the source of toIntegers(final List longs)

Description

Converts a list of Longs to Integers

License

Open Source License

Parameter

Parameter Description
longs the longs

Return

a list of Integers

Declaration

public static List<Integer> toIntegers(final List<Long> longs) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;
import java.util.List;

public class Main {
    /**//from   w w  w.jav  a  2s . co m
     * Converts a list of Longs to Integers
     *
     * @param longs
     *            the longs
     * @return a list of Integers
     */
    public static List<Integer> toIntegers(final List<Long> longs) {
        final List<Integer> ints = new ArrayList<>();
        for (final Long lng : longs) {
            ints.add(lng.intValue());
        }

        return ints;
    }
}

Related

  1. toIntegerList(final E[] array)
  2. toIntegerList(int... array)
  3. toIntegerList(int[] array)
  4. toIntegerList(int[] intArray)
  5. toIntegerList(List strList, boolean failOnException)
  6. toIntegers(List values)
  7. toIntList(List list)
  8. toIntList(Set members)
  9. toIntList(String arr, String separator)