Package javatapas.util
Class IncrementCounterMap
java.lang.Object
javatapas.util.IncrementCounterMap
public class IncrementCounterMap extends Object
Increment an Integer Counter Using a Map<String, Integer>.
Published at https://www.javatapas.com/util/Java-Increment-Counter-Map.html
Javadoc at https://www.javatapas.com/docs/javatapas/util/IncrementCounterMap.html
Published at https://www.javatapas.com/util/Java-Increment-Counter-Map.html
Javadoc at https://www.javatapas.com/docs/javatapas/util/IncrementCounterMap.html
- Version:
- 2021-05-18
- Author:
- Kodiak Brown
-
Constructor Summary
Constructors Constructor Description IncrementCounterMap()
-
Method Summary
Modifier and Type Method Description static void
incrementCounterMap(Map<String,Integer> counterMap, String key)
This will default to start value of 0 and an increment value of 1.static void
incrementCounterMap(Map<String,Integer> counterMap, String key, int incValue)
This will default to start value of 0.static void
incrementCounterMap(Map<String,Integer> counterMap, String key, int startValue, int incValue)
-
Constructor Details
-
IncrementCounterMap
public IncrementCounterMap()
-
-
Method Details
-
incrementCounterMap
This will default to start value of 0 and an increment value of 1.- Parameters:
counterMap
- The Map mapping String keys to integer values identifying the number of times the key has been called.key
- The String key that is being incremented.
-
incrementCounterMap
This will default to start value of 0.- Parameters:
counterMap
- The Map mapping String keys to integer values identifying the number of times the key has been called.key
- The String key that is being incremented.incValue
- The amount to increment the counter by.
-
incrementCounterMap
public static void incrementCounterMap(Map<String,Integer> counterMap, String key, int startValue, int incValue)- Parameters:
counterMap
- The Map mapping String keys to integer values identifying the number of times the key has been called.key
- The String key that is being incremented.startValue
- The value to start the counter with.incValue
- The amount to increment the counter by.
-