diff --git a/core-java/src/main/java/com/baeldung/outofmemoryerror/java-outofmemoryerror-demo/src/main/java/com/baeldung/outofmemoryerror/java_outofmemoryerror_demo/OutOfMemoryGCLimitExceed.java b/core-java/src/main/java/com/baeldung/outofmemoryerror/java-outofmemoryerror-demo/src/main/java/com/baeldung/outofmemoryerror/java_outofmemoryerror_demo/OutOfMemoryGCLimitExceed.java index 57c14571c3..65b7950964 100644 --- a/core-java/src/main/java/com/baeldung/outofmemoryerror/java-outofmemoryerror-demo/src/main/java/com/baeldung/outofmemoryerror/java_outofmemoryerror_demo/OutOfMemoryGCLimitExceed.java +++ b/core-java/src/main/java/com/baeldung/outofmemoryerror/java-outofmemoryerror-demo/src/main/java/com/baeldung/outofmemoryerror/java_outofmemoryerror_demo/OutOfMemoryGCLimitExceed.java @@ -1,14 +1,15 @@ package com.baeldung.outofmemoryerror.java_outofmemoryerror_demo; +import java.util.HashMap; import java.util.Map; import java.util.Random; public class OutOfMemoryGCLimitExceed { - public static void putPropertiesToMap() { - Map map = System.getProperties(); + public static void addRandomDataToMap() { + Map dataMap = new HashMap(); Random r = new Random(); while (true) { - map.put(r.nextInt(), "value"); + dataMap.put(r.nextInt(), String.valueOf(r.nextInt())); } } }