static A last(L l) { return empty(l) ? null : l.get(l.size()-1); } static char last(S s) { ret empty(s) ? '#' : s.charAt(l(s)-1); } static byte last(byte[] a) { ret l(a) != 0 ? a[l(a)-1] : 0; } meta-for int also as long { static int last(int[] a) { ret l(a) != 0 ? a[l(a)-1] : 0; } } static double last(double[] a) { ret l(a) != 0 ? a[l(a)-1] : 0; } static A last(A[] a) { ret l(a) != 0 ? a[l(a)-1] : null; } static A last(Iterator it) { A a = null; while ping (it.hasNext()) a = it.next(); ret a; } static A last(Cl l) { if (l == null) null; if (l cast L) ret (A) last(l); if (l cast SortedSet) ret (A) last(l); Iterator it = iterator(l); A a = null; while ping (it.hasNext()) a = it.next(); ret a; } static A last(SortedSet l) { ret l == null ? null : l.last(); } ifclass ReverseChain static A last(ReverseChain l) { ret l?.element; } endif ifclass IntBuffer static int last(IntBuffer buf) { ret buf.get(buf.size()-1); } endif ifclass ByteBuffer static byte last(ByteBuffer buf) { ret buf.get(buf.size()-1); } endif ifclass DoubleBuffer static double last(DoubleBuffer l) { ret l.last(); } endif ifclass IDoubleBuffer static double last(IDoubleBuffer l) { ret l.last(); } endif ifclass ILongBuffer static long last(ILongBuffer l) { ret l.last(); } endif ifclass LongBuffer static long last(LongBuffer l) { ret l.last(); } endif ifclass SynchronizedDoubleBuffer static double last(SynchronizedDoubleBuffer l) { ret l.last(); } endif ifclass SynchronizedLongBuffer static long last(SynchronizedLongBuffer l) { ret l.last(); } endif ifclass CompactLinkedHashSet static A last(CompactLinkedHashSet set) { ret set?.last(); } endif