private Map<Long, FastIDSet> readUserItemFilter(String pathString) throws IOException { Map<Long, FastIDSet> result = new HashMap<>(); try (InputStream in = openFile(pathString)) { for (String line : new FileLineIterable(in)) { try { String[] tokens = SEPARATOR.split(line); Long userId = Long.parseLong(tokens[0]); Long itemId = Long.parseLong(tokens[1]); addUserAndItemIdToUserItemFilter(result, userId, itemId); } catch (NumberFormatException nfe) { log.warn("userItemFile line ignored: {}", line); } } } return result; }
private Map<Long, FastIDSet> readUserItemFilter(String pathString) throws IOException { Map<Long, FastIDSet> result = Maps.newHashMap(); InputStream in = openFile(pathString); try { for (String line : new FileLineIterable(in)) { try { String[] tokens = SEPARATOR.split(line.toString()); Long userId = Long.parseLong(tokens[0]); Long itemId = Long.parseLong(tokens[1]); addUserAndItemIdToUserItemFilter(result, userId, itemId); } catch (NumberFormatException nfe) { log.warn("userItemFile line ignored: {}", line); } } } finally { Closeables.close(in, true); } return result; }
private FastIDSet readIDList(String pathString) throws IOException { FastIDSet result = null; if (pathString != null) { result = new FastIDSet(); try (InputStream in = openFile(pathString)){ for (String line : new FileLineIterable(in)) { try { result.add(Long.parseLong(line)); } catch (NumberFormatException nfe) { log.warn("line ignored: {}", line); } } } } return result; }
private FastIDSet readIDList(String pathString) throws IOException { FastIDSet result = null; if (pathString != null) { result = new FastIDSet(); InputStream in = openFile(pathString); try { for (String line : new FileLineIterable(in)) { try { result.add(Long.parseLong(line)); } catch (NumberFormatException nfe) { log.warn("line ignored: {}", line); } } } finally { Closeables.close(in, true); } } return result; }