3 import java.io.Closeable;
4 import java.io.IOException;
5 import java.io.InputStream;
6 import java.io.OutputStream;
7 import java.util.Iterator;
12 public static <E> E nonnull(E ob)
14 if (ob == null) throw new NullPointerException();
18 public static void transfer(InputStream is, OutputStream os)
21 byte[] buffer = new byte[16384];
23 while ((len = is.read(buffer)) != -1)
24 os.write(buffer, 0, len);
27 public static void nothrowClose(Closeable c)
33 catch (IOException e) {}
37 public static <E> E first(Iterable<E> i)
39 Iterator<E> it = i.iterator();
40 if (it.hasNext()) return it.next();
44 public static <E> E first(Iterator<E> it)
46 if (it.hasNext()) return it.next();