Package jenkins.util
Class MemoryReductionUtil
- java.lang.Object
-
- jenkins.util.MemoryReductionUtil
-
public class MemoryReductionUtil extends Object
Utilities to reduce memory footprint- Author:
- Sam Van Oort
-
-
Field Summary
Fields Modifier and Type Field Description static String[]EMPTY_STRING_ARRAYEmpty string array, exactly what it says on the tin.
-
Constructor Summary
Constructors Constructor Description MemoryReductionUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static MapgetPresizedMutableMap(int elementCount)Returns a mutable HashMap presized to hold the given number of elements without needing to resize.static String[]internInPlace(String[] input)Returns the input strings, but with all values interned.static intpreallocatedHashmapCapacity(int elementsToHold)Returns the capacity we need to allocate for a HashMap so it will hold all elements without needing to resize.
-
-
-
Field Detail
-
EMPTY_STRING_ARRAY
public static final String[] EMPTY_STRING_ARRAY
Empty string array, exactly what it says on the tin. Avoids repeatedly created empty array when calling "toArray."
-
-
Method Detail
-
preallocatedHashmapCapacity
public static int preallocatedHashmapCapacity(int elementsToHold)
Returns the capacity we need to allocate for a HashMap so it will hold all elements without needing to resize.
-
getPresizedMutableMap
public static Map getPresizedMutableMap(int elementCount)
Returns a mutable HashMap presized to hold the given number of elements without needing to resize.
-
-