List of usage examples for org.apache.commons.collections.primitives LongList toArray
long[] toArray();
From source file:net.sf.sprockets.sql.Statements.java
/** * Execute the query, get the long values in the first column of the result set, and close the * statement./*from w w w . j av a2 s.co m*/ * * @param stmt * must already have parameters set * @return null if the result set is empty * @since 1.4.0 */ public static long[] allLongs(PreparedStatement stmt) throws SQLException { long[] l = null; ResultSet rs = stmt.executeQuery(); if (rs.next()) { LongList list = new ArrayLongList(); do { list.add(rs.getLong(1)); } while (rs.next()); l = list.toArray(); } stmt.close(); return l; }
From source file:architecture.ee.web.community.poll.DefaultPollManager.java
private List<User> toUserList(LongList userIds) { List<User> users = new ArrayList<User>(); for (long userId : userIds.toArray()) { try {/* w w w . ja v a 2s . com*/ users.add(userManager.getUser(userId)); } catch (UserNotFoundException e) { } } return users; }