/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
interface IMotor extends ICambio {
public void SetMotor
(String v
); }
interface ICambio {
public void SetCambio
(String v
); }
interface IRobo {
}
class Car implements IMotor, IRobo{
/**
* @return the id
*/
return id;
}
/**
* @param id the id to set
*/
this.id = id;
}
/**
* @return the description
*/
public String getDescription
() { return description;
}
/**
* @param description the description to set
*/
public void setDescription
(String description
) { this.description = description;
}
@Override
public void SetMotor
(String v
) { }
@Override
public void SetCambio
(String v
) { }
}
class Ideone
{
{
Car car = new Car();
Class<?>[] interfaces = car.getClass().getInterfaces();
ArrayList<String> items = new ArrayList<>();
SetInterfaces(interfaces, items)
.forEach((item) -> {
});
}
public static ArrayList<String> SetInterfaces(Class<?>[] interfaces, ArrayList<String> items)
{
for (Class<?> intf : interfaces) {
items.add(intf.getName());
SetInterfaces(intf.getInterfaces(), items);
}
return items;
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgppbnRlcmZhY2UgSU1vdG9yIGV4dGVuZHMgSUNhbWJpbyB7CiAgICBwdWJsaWMgdm9pZCBTZXRNb3RvcihTdHJpbmcgdik7Cn0KaW50ZXJmYWNlIElDYW1iaW8gewogICAgcHVibGljIHZvaWQgU2V0Q2FtYmlvKFN0cmluZyB2KTsKfQppbnRlcmZhY2UgSVJvYm8gewogICAgCn0KY2xhc3MgQ2FyIGltcGxlbWVudHMgSU1vdG9yLCBJUm9ib3sKCiAgICAvKioKICAgICAqIEByZXR1cm4gdGhlIGlkCiAgICAgKi8KICAgIHB1YmxpYyBJbnRlZ2VyIGdldElkKCkgewogICAgICAgIHJldHVybiBpZDsKICAgIH0KCiAgICAvKioKICAgICAqIEBwYXJhbSBpZCB0aGUgaWQgdG8gc2V0CiAgICAgKi8KICAgIH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