title: Creating a space efficient generic object in java
body: <p>I'm trying to create an object that is simultaneously as space efficient as possible but can also work generically and I'm running into a major problem. One of the optimizations I wanted to make is to remove the wrappers from the keys (of which there can be an arbitrary number of arbitrary types). But I am running into an issue with the nature of generics in Java.</p>
  
  <p>It seems that to make a function generic it MUST take in Objects which would require wrapper classes. A workaround would be if I could dynamically create a primitive typed array. Does anyone have an idea how I could accomplish this? </p>