Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

instanceof Fails #248

Open
olimaticer opened this issue Sep 13, 2017 · 2 comments
Open

instanceof Fails #248

olimaticer opened this issue Sep 13, 2017 · 2 comments

Comments

@olimaticer
Copy link
Contributor

Object o = b.get(tag);
Unknowing the real reasons
if (o instanceof Double)
fails sometimes.

Workaround:
if (o.toString().indexOf("[D@") == 0)

Gregor

@jMarcS
Copy link
Collaborator

jMarcS commented Sep 13, 2017

What is the failure? What type of object are you trying to get when it fails?
When you use your workaround, what changes?
How did you choose the argument of indexOf and what does it mean?

It's not at all clear to me what you're doing or why.

@olimaticer
Copy link
Contributor Author

olimaticer commented Sep 16, 2017

It's not at all clear to me what you're doing or why.

I was getting numeric arrays from a bundle.
I have to deside what type of numeric array value is to convert it into Double.

Many thanks for your questions!
After a creative distance from some days I found my mistake.
I am working with an object array Object[] !!!
After printing object.toString() i got "[D@abcd...". It seems that
[ stands for an array maybe --> Class
D for the type Double --> Name
@ is a delimiter
and the rest is the hashCode().
getClass().getName() + '@' + Integer.toHexString(hashCode())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants