W
WJ
I have two quick questions.
1. I have a lot of places I need to convert Strings and ints back and
forth. I've read that creating an Integer object and doing a .parseInt or
..toString is not efficient, especially when doing it alot. Is there a
better way?
I'm working on switching the source to all one type, but I don't have
control of that.
2. I need to look up a value based on two keys, sort of like a map. So I'd
have values like
1 1 Value a
1 2 Value b
2 1 Value c
2 2 Value d
2 3 Value e
I thought of having a map of maps. Each one could have several entries and
I like the hash lookup. But the code seems inefficient to map.get("2"),
cast that as a map, then map.get("3"), to get the value I want.
is there a better way?
Thanks!
1. I have a lot of places I need to convert Strings and ints back and
forth. I've read that creating an Integer object and doing a .parseInt or
..toString is not efficient, especially when doing it alot. Is there a
better way?
I'm working on switching the source to all one type, but I don't have
control of that.
2. I need to look up a value based on two keys, sort of like a map. So I'd
have values like
1 1 Value a
1 2 Value b
2 1 Value c
2 2 Value d
2 3 Value e
I thought of having a map of maps. Each one could have several entries and
I like the hash lookup. But the code seems inefficient to map.get("2"),
cast that as a map, then map.get("3"), to get the value I want.
is there a better way?
Thanks!