import java.io.OutputStream;
import java.util.Iterator;
-public class Util {
-
- public static <E> E nonnull(E ob) {
- if (ob == null)
- throw new NullPointerException();
- return ob;
- }
-
- public static void transfer(InputStream is, OutputStream os)
- throws IOException {
- byte[] buffer = new byte[16384];
- int len = -1;
- while ((len = is.read(buffer)) != -1)
- os.write(buffer, 0, len);
- }
-
- public static void nothrowClose(Closeable c) {
- if (c != null) {
- try {
- c.close();
- } catch (IOException e) {}
- }
- }
-
- public static <E> E first(Iterable<E> i)
- {
- Iterator<E> it = i.iterator();
- if (it.hasNext())
- return it.next();
- return null;
- }
+public class Util
+{
+
+ public static <E> E nonnull(E ob)
+ {
+ if (ob == null) throw new NullPointerException();
+ return ob;
+ }
+
+ public static void transfer(InputStream is, OutputStream os)
+ throws IOException
+ {
+ byte[] buffer = new byte[16384];
+ int len = -1;
+ while ((len = is.read(buffer)) != -1)
+ os.write(buffer, 0, len);
+ }
+
+ public static void nothrowClose(Closeable c)
+ {
+ if (c != null) {
+ try {
+ c.close();
+ }
+ catch (IOException e) {}
+ }
+ }
+
+ public static <E> E first(Iterable<E> i)
+ {
+ Iterator<E> it = i.iterator();
+ if (it.hasNext()) return it.next();
+ return null;
+ }
+
+ public static <E> E first(Iterator<E> it)
+ {
+ if (it.hasNext()) return it.next();
+ return null;
+ }
+
}