I had a number of classes which extended an abstract class. Each of these classes could be returned in a 'set' by a method elsewhere in the project.
public abstract class AbstractBuilding{
    ....
}
public class ABuilding extends AbstractBuilding{
    ....
}     
In another class:
World world = worldManager.getWorld();   
   for (AbstractBuilding building : world.getBuildings()){
       if (building.toString().contains("SomeSequence")){
            //Do Something
       }
    }
Where world.getBuildings() returns a set of all Abstract Buildings/classes.
Due to design changes, ABuilding is now an Abstract Class itself in addition to extending the original AbstractBuilding. And more classes extend from ABuilding. 
Note: I still have other regular classes which extend AbstractBuilding as before - ABuilding2
public abstract class AbstractBuilding{
    ....
}
public class ABuilding2 extends AbstractBuilding{
    ....
}
public abstract class ABuilding extends AbstractBuilding{
    ....
}
public class TheBuilding extends ABuilding{
    ....
}
When I call the world.getBuildings method now, I still get the set of all abstract buildings, which include buildings such as TheBuilding as it extends ABuilding which itself extends AbstractBuilding.
Is there some way that I can identify if a building in the returned set of buildings extends from this new abstract building?
