@Test public void toMapTest() throws IllegalArgumentException, IOException { TreeSet<Object[]> data = CSVReader.readCsv(LOGGER, csv, ",", new SetComparator<Integer>(new IntegerCaster(),2,false), false, false); Object[] first = data.first(); Assert.assertNotNull(first); Assert.assertNotNull(first[2].equals("23")); Assert.assertTrue(first[3].equals("23_airtmp_mn.tif")); Object[] last = data.last(); Assert.assertNotNull(last); Assert.assertNotNull(last[2].equals("38213")); Assert.assertTrue(last[4].equals("SOLAW:lw_scar")); CSVWriter.writeCsv(LOGGER, data.descendingSet(), csvOut, ",", false); TreeSet<Object[]> newData = CSVReader.readCsv(LOGGER, csvOut, ",", new SetComparator<Integer>(new IntegerCaster(),2,true), false, false); newData.first(); Assert.assertNotNull(first); Assert.assertNotNull(first[2].equals("23")); Assert.assertTrue(first[3].equals("23_airtmp_mn.tif")); last = newData.last(); Assert.assertNotNull(last); Assert.assertNotNull(last[2].equals("38213")); Assert.assertTrue(last[4].equals("SOLAW:lw_scar")); }
public static <T, D extends Set<Object[]>> void writeCsv( final Logger LOGGER, final D data, final File csv, final String separator, final boolean failsOnError) throws IllegalArgumentException, IOException { FileWriter fw = null; BufferedWriter writer = null; try { fw = new FileWriter(csv); writer = new BufferedWriter(fw); final Iterator<Object[]> it = data.iterator(); while (it.hasNext()) { Object[] entry = it.next(); writeLine(LOGGER, entry, separator, writer); } } finally { try { if (writer != null) writer.close(); } catch (IOException e) { } try { if (fw != null) fw.close(); } catch (IOException e) { } } }
CSVWriter { public static <T, D extends Set<Object[]>> void writeCsv( final Logger LOGGER, final D data, final File csv, final String separator, final boolean failsOnError) throws IllegalArgumentException, IOException { FileWriter fw = null; BufferedWriter writer = null; try { fw = new FileWriter(csv); writer = new BufferedWriter(fw); final Iterator<Object[]> it = data.iterator(); while (it.hasNext()) { Object[] entry = it.next(); writeLine(LOGGER, entry, separator, writer); } } finally { try { if (writer != null) writer.close(); } catch (IOException e) { } try { if (fw != null) fw.close(); } catch (IOException e) { } } } }
CSVWriter { public static <T, D extends Set<Object[]>> void writeCsv( final Logger LOGGER, final D data, final File csv, final String separator, final boolean failsOnError) throws IllegalArgumentException, IOException { FileWriter fw = null; BufferedWriter writer = null; try { fw = new FileWriter(csv); writer = new BufferedWriter(fw); final Iterator<Object[]> it = data.iterator(); while (it.hasNext()) { Object[] entry = it.next(); writeLine(LOGGER, entry, separator, writer); } } finally { try { if (writer != null) writer.close(); } catch (IOException e) { } try { if (fw != null) fw.close(); } catch (IOException e) { } } }  }
CSVWriter { public static <T, D extends Set<Object[]>> void writeCsv( final Logger LOGGER, final D data, final File csv, final String separator, final boolean failsOnError) throws IllegalArgumentException, IOException { FileWriter fw = null; BufferedWriter writer = null; try { fw = new FileWriter(csv); writer = new BufferedWriter(fw); final Iterator<Object[]> it = data.iterator(); while (it.hasNext()) { Object[] entry = it.next(); writeLine(LOGGER, entry, separator, writer); } } finally { try { if (writer != null) writer.close(); } catch (IOException e) { } try { if (fw != null) fw.close(); } catch (IOException e) { } } }  static void writeCsv(
            final Logger LOGGER, final D data, final File csv, final String separator,
            final boolean failsOnError); }
CSVWriter { public static <T, D extends Set<Object[]>> void writeCsv( final Logger LOGGER, final D data, final File csv, final String separator, final boolean failsOnError) throws IllegalArgumentException, IOException { FileWriter fw = null; BufferedWriter writer = null; try { fw = new FileWriter(csv); writer = new BufferedWriter(fw); final Iterator<Object[]> it = data.iterator(); while (it.hasNext()) { Object[] entry = it.next(); writeLine(LOGGER, entry, separator, writer); } } finally { try { if (writer != null) writer.close(); } catch (IOException e) { } try { if (fw != null) fw.close(); } catch (IOException e) { } } }  static void writeCsv(
            final Logger LOGGER, final D data, final File csv, final String separator,
            final boolean failsOnError);  }