Carey Brown wrote:Arrays.asList(a) doesn't behave like I thought it would. Any suggestions on how to make this more generic?
No, but you can wrap an int as a List, viz:
Give it a try.
I really suggest you have a look at AbstractList (and AbstractMap, and a few of the other 'Abstract...' classes in java.util) because they really are very useful to know about.
That 'IntList' definition above is a fully-functioning immutable List in 19 lines of code, which, considering all the things that a List can do, is pretty impressive. And if you want to be able to change values, you can do that too.
But I'll leave you to read about it. That was just a "taster".
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Once I see methods like that, also the toArray method of Stream, I start wishing I had never seen arrays of primitives. We might start by teaching people about int arrays, but they are really awkward to handle compared to Object arrays.