import java.util.*;
class Main {
public static HashMap
<String, String
> lista
= new HashMap
<>();
for (int i = 0; i < 100000; i++) if (lista.containsKey("antonio")) lista.put(teste, outra);
}
for (int i = 0; i < 100000; i++) lista.replace(teste, outra);
}
public static void main
(String[] args
) { long inicio
= System.
currentTimeMillis(); Put("antonio", "antonio");
System.
out.
println("Put: " + (System.
currentTimeMillis() - inicio
) + " ms"); inicio
= System.
currentTimeMillis(); Replace("antonio", "antonio");
System.
out.
println("Replace: " + (System.
currentTimeMillis() - inicio
) + " ms"); }
}
//https://pt.stackoverflow.com/q/319076/101
aW1wb3J0IGphdmEudXRpbC4qOwoKY2xhc3MgTWFpbiB7CglwdWJsaWMgc3RhdGljIEhhc2hNYXA8U3RyaW5nLCBTdHJpbmc+IGxpc3RhID0gbmV3IEhhc2hNYXA8PigpOwoJCglwcml2YXRlIHN0YXRpYyB2b2lkIFB1dChTdHJpbmcgdGVzdGUsIFN0cmluZyBvdXRyYSkgewoJICAgIGZvciAoaW50IGkgPSAwOyBpIDwgMTAwMDAwOyBpKyspIGlmIChsaXN0YS5jb250YWluc0tleSgiYW50b25pbyIpKSBsaXN0YS5wdXQodGVzdGUsIG91dHJhKTsKCX0KCQoJcHJpdmF0ZSBzdGF0aWMgdm9pZCBSZXBsYWNlKFN0cmluZyB0ZXN0ZSwgU3RyaW5nIG91dHJhKSB7CgkgICAgZm9yIChpbnQgaSA9IDA7IGkgPCAxMDAwMDA7IGkrKykgbGlzdGEucmVwbGFjZSh0ZXN0ZSwgb3V0cmEpOwoJfQoJCglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbihTdHJpbmdbXSBhcmdzKSB7CgkgICAgbG9uZyBpbmljaW8gPSBTeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKTsKCSAgICBQdXQoImFudG9uaW8iLCAiYW50b25pbyIpOwoJICAgIFN5c3RlbS5vdXQucHJpbnRsbigiUHV0OiAiICsgKFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpIC0gaW5pY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