Java tutorial
//package com.java2s; import java.util.ArrayList; import java.util.List; public class Main { public static List<Long> transferToLongList(List doubleIdList) { List<Long> longIdList = new ArrayList<Long>(); for (Object obj : doubleIdList) { if (obj instanceof Double) { try { Long tempId = ((Double) obj).longValue(); longIdList.add(tempId); } catch (Exception e) { e.printStackTrace(); } } else if (obj instanceof Long) { longIdList.add((Long) obj); } else if (obj instanceof Integer) { longIdList.add(Long.parseLong(obj.toString())); } } return longIdList; } }