I have an enum which contains a collection of Strings mapped to names and integers. I would like to return the integers based on the String inside the enum.

I am using the enum for some other purposes as well so I would like to keep it (otherwise I would just use HashMap for this purpose). Is it even possible?

This is an example demonstrating what I would like to achieve

```
public enum Types {

 A("a.micro", 1), B("b.small", 2), C("c.medium", 4);

private String type;
  private int size;

  private Type(String type, int size) {
    this.type = type;
    this.size = size;
  }

  public String getType() {
    return type;
  }

  public int getSize() {
    return size;
  }
}

```

I would like to return the size based on the type:

```
Type.valueOf("a.micro").getSize();

```