Java — Primitive Counterpart of Byte, Integer, Long, etc. in template
BACKGROUND : I am trying to implement a tiny template, i.e. generic class, which would allow me to achieve a pass-by-reference functionality as follows. public static class Ref<T> { T value; public Ref(T InitValue) { this.set(InitValue); } public void set(T Value) { this.value = Value; } public T get() { return this.value; } } So, I could define a function that takes a 'Ref' where the value can actually be changed, e.g. public static void function(Ref<Byte> x) { x.set((byte)0x7E); } The initialization of the variable to be passed by reference looks not so elegant. Ref<Byte> to_be_changed = new