Get Object id[]

Asked

Viewed 71 times

-3

I need to get the id of these objects.

Object[] classe = getNames().toArray();

String[] strings = Arrays.stream(classe ).map(Object::toString).
                toArray(String[]::new);

for (int i=0;i<strings.length;i++)
        {
            Integer id =strings[i].id;
        }

Theoretically it would be like this, but I can’t get the id. On the console I see the whole object.

  • 1

    Post the class containing such ìd that you want to take. Provide as much information as possible so the community can contextualize your difficulty and help you.

1 answer

0

Impossible as you are doing since your array String[] strings is a array of String and the String class does not have a property id.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.