Can anyone tell me what kind of object allows me to do an array of value and function similar to the code below and action script 3? If it were in Java it would give something like this:
My Interface:
package test;
public interface MyInterface {
public void alert();
}
And my class using Interface:
package test;
import java.util.HashMap;
import java.util.Map;
public class MyClass {
public static void main(String[] args) {
Map<Integer, MyInterface> map = new HashMap<>();
map.put(1, new MyInterface() {
@Override
public void alert() {
System.out.println("valor 1");
}
});
map.put(2, new MyInterface() {
@Override
public void alert() {
System.out.println("valor 2");
}
});
}
}