Last active
August 29, 2015 14:15
-
-
Save felipebizz/6366968b85b7d664e90b to your computer and use it in GitHub Desktop.
Atualizando valor de um HashMap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class UpdateHashMap { | |
public static void main(String [] args) { | |
Map<String, String[]> formParameters = new HashMap<>(); | |
String[] a = new String[1]; | |
a[0] = "done"; | |
String[] b = new String[1]; | |
b[0] = "lua_çêéóú.JPG"; | |
formParameters.put("upload-original-div_0_name", b); | |
formParameters.put("upload-original-div_0_status", a); | |
if (formParameters.containsKey("upload-original-div_0_name")){ | |
String[] value =formParameters.get("upload-original-div_0_name"); | |
System.out.println("Initial Value = " + value[0]); | |
String[] newArray = new String[1]; | |
newArray[0] = "lua_ceeou.JPG"; | |
formParameters.put("upload-original-div_0_name",newArray); | |
} | |
System.out.println("Map updated ===="); | |
for (String[] key : formParameters.values()) { | |
for (String string : key){ | |
System.out.println(key.toString() + " - " + string); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment