ifndef NoGenericFunctions static O first(O list) { ret first((Iterable) list); } endifndef static A first(L list) { return empty(list) ? null : list.get(0); } static A first(A[] bla) { ret bla == null || bla.length == 0 ? null : bla[0]; } ifclass IterableIterator static A first(IterableIterator i) { ret first((Iterator) i); } endif static A first(Iterator i) { ret i == null || !i.hasNext() ? null : i.next(); } static A first(Iterable i) { if (i == null) ret null; Iterator it = i.iterator(); ret it.hasNext() ? it.next() : null; } static Char first(S s) { ret empty(s) ? null : s.charAt(0); } static Char first(CharSequence s) { ret empty(s) ? null : s.charAt(0); } ifclass Pair static A first(Pair p) { ret p == null ? null : p.a; } endif ifclass T3 static A first(T3 t) { ret t == null ? null : t.a; } endif static Byte first(byte[] l) { ret empty(l) ? null : l[0]; } ifclass IntBuffer static int first(IntBuffer buf) { ret buf.get(0); } endif ifclass ByteBuffer static byte first(ByteBuffer buf) { ret buf.get(0); } endif