Java tutorial
//package com.java2s; /* * Copyright Gergely Nagy <greg@webhejj.hu> * * Licensed under the Apache License, Version 2.0; * you may obtain a copy of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 */ import java.io.IOException; public class Main { /** * Writes the string value of the specified items to appendable, * wrapping an eventual IOException into a RuntimeException * * @param appendable to append values to * @param items items to dump */ public static void dump(Appendable appendable, Iterable<?> items) { try { for (Object item : items) { appendable.append(String.valueOf(item)); appendable.append("\n"); } } catch (IOException e) { throw new RuntimeException("An error occured while appending", e); } } }