Is there any way to compare two primitives to find out if they are not only the same value but actually the same object?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
The operator you're looking for is ===. It doesn't work on pure primitive entities, but it does work on references to those entities. The opposite test is !==.
If you try to use Integer directly, for example, you'll get a compile error:
Have you looked at the new Type methods?
Will this accomplish what you are looking to do?