To convert a string to enum in Java you can use the following snippet.
Considering the following enum.
Sample Java
public enum Testenum { One,Two,Three,Four }
you can cast an string to enum like this:
Sample Java
Testenum.valueOf("Two");
To convert a string to enum in Java you can use the following snippet.
Considering the following enum.
public enum Testenum { One,Two,Three,Four }
you can cast an string to enum like this:
Testenum.valueOf("Two");
You can declare an array in Java in 3 different ways.
int[] myArr = new int[5]; int[] myArr = {1,2,3,4,5}; int[] myArr = new int[]{1,2,3,4,5};
To iterate throug a map in Java you can use the snippet below.
for (Map.Entry<String, Object> entry : mp.entrySet()) { String key = entry.getKey(); Object value = entry.getValue(); }