Strings are interned in Java, so this is taken care of automatically.
I.e. all "42" strings are the same instance.
See, e.g.
http://en.wikipedia.org/wiki/String_intern_pool
http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#19369
/Fredrik
On 22 Mar, 06:41, "Kapil.dalwani" w
Hi,
> a) Use a HashMap where the key is i * j and value is
> my required String "i" + "-" +j
An i * j key will result on the same key for both (i = 1, j = 2) and
(i = 2, j = 1).
> c) Any other great suggestion?
StringBuilder can help.
[]'s
Rodrigo
--~--~-~--~~~--