Search:

Type: Posts; User: srs

Search: Search took 0.11 seconds.

  1. Replies
    5
    Views
    3,749

    Re: Compare instance of a class to another

    So the short answer is use .class for the known, existing object?
    So for my use it may look something like this:

    if (incomingObject.getClass() == map[0][0].class()) {
    // Note the null check is...
  2. Replies
    5
    Views
    3,749

    Re: Compare instance of a class to another

    Thanks for the instancoof suggestion. By it's name, I thought it would work, but seems this is not so.
    class Parent {
    public Parent() {
    }
    }
    class Child extends Parent {
    public Child() {...
  3. Replies
    5
    Views
    3,749

    Compare instance of a class to another

    I have an incoming object of an unknown class (null possible). I need to test if the object is of a specific class.
    if (incomingObject.getClass() == map[0][0].getClass()) {
    // go go go!
    }...
Results 1 to 3 of 3