Here you can find the source of saveLongList(String file, Collection
public static void saveLongList(String file, Collection<Long> c, boolean append) throws FileNotFoundException, IOException
//package com.java2s; /*/*from w w w . java2 s. c om*/ * Copyright (C) ${year} Omry Yadan <${email}> * All rights reserved. * * See https://github.com/omry/banana/blob/master/BSD-LICENSE for licensing information */ import java.io.*; import java.util.*; public class Main { public static void saveLongList(String file, Collection<Long> c, boolean append) throws FileNotFoundException, IOException { File p = new File(file).getParentFile(); if (p != null) p.mkdirs(); FileOutputStream fout = new FileOutputStream(file, append); try { for (Long subjectID : c) { fout.write((subjectID + "\n").getBytes()); } } finally { fout.close(); } } public static void saveLongList(String file, Collection<Long> c) throws FileNotFoundException, IOException { saveLongList(file, c, false); } }