public class SystemUtil extends Object
| Constructor and Description | 
|---|
| SystemUtil() | 
| Modifier and Type | Method and Description | 
|---|---|
| static <T> void | addWithoutDuplicates(List<T> dest,
                    List<? extends T> source)Adds, to dest, all the elements of source that are not already in dest. | 
| static <T> T[] | concatenate(T[] array1,
           T... array2)Deprecated. 
 use StringsPlume.concatenate | 
| static <T> T[] | concatenate(T firstElt,
           T[] array,
           T lastElt)Deprecated. 
 use PlumeUtil.concat | 
| static boolean | getBooleanSystemProperty(String key)Deprecated. 
 use UtilPlume.getBooleanSystemProperty | 
| static boolean | getBooleanSystemProperty(String key,
                        boolean defaultValue)Deprecated. 
 use UtilPlume.getBooleanSystemProperty | 
| static int | getJreVersion()Returns the major JRE version. | 
| static @Nullable String | getReleaseValue(ProcessingEnvironment env)Returns the release value passed to the compiler or null if release was not passed. | 
| static @Nullable String | getToolsJar()Returns the pathname to the tools.jar file, or null if it does not exist. | 
| static <T> List<T> | intersection(List<? extends T> list1,
            List<? extends T> list2)Returns a list that contains all the elements that are in both lists: that is, the set
 difference of the two arguments. | 
| static int | mapCapacity(Collection<?> c)Deprecated. 
 use CollectionsPlume.mapCapacity | 
| static int | mapCapacity(int numElements)Deprecated. 
 use CollectionsPlume.mapCapacity | 
| static int | mapCapacity(Map<?,?> m)Deprecated. 
 use CollectionsPlume.mapCapacity | 
| static List<String> | readFile(File argFile)Deprecated. 
 use Files.readAllLines | 
| static void | sleep(long millis)Deprecated. 
 use SystemPlume.sleep | 
| static <T> List<T> | union(List<T> list1,
     List<T> list2)Returns a list that contains all the distinct elements of the two lists: that is, the union of
 the two arguments. | 
public static int getJreVersion()
This is different from the version passed to the compiler via --release; use getReleaseValue(ProcessingEnvironment) to get that version.
 
Extract the major version number from the "java.version" system property. Two possible formats are considered. Up to Java 8, from a version string like `1.8.whatever`, this method extracts 8. Since Java 9, from a version string like `11.0.1`, this method extracts 11.
public static @Nullable String getReleaseValue(ProcessingEnvironment env)
env - the ProcessingEnvironmentpublic static @Nullable String getToolsJar()
public static <T> List<T> union(List<T> list1, List<T> list2)
For very short lists, this is likely more efficient than creating a set and converting back to a list.
T - the type of the list elementslist1 - a listlist2 - a listpublic static <T> void addWithoutDuplicates(List<T> dest, List<? extends T> source)
For very short lists, this is likely more efficient than creating a set and converting back to a list.
T - the type of the list elementsdest - a list to add tosource - a list of elements to addpublic static <T> List<T> intersection(List<? extends T> list1, List<? extends T> list2)
For very short lists, this is likely more efficient than creating a set and converting back to a list.
T - the type of the list elementslist1 - a listlist2 - a listlist1 that are not in list2@Deprecated public static List<String> readFile(File argFile) throws IOException
argFile - argument fileIOException - when reading the argFile@Deprecated public static void sleep(long millis)
millis - the length of time to sleep in milliseconds@Deprecated public static <T> T[] concatenate(T firstElt, T[] array, T lastElt)
T - the type of the array elementsfirstElt - the first elementarray - the arraylastElt - the last elemeent@Deprecated public static boolean getBooleanSystemProperty(String key)
key - system property to check@Deprecated public static boolean getBooleanSystemProperty(String key, boolean defaultValue)
key - system property to checkdefaultValue - value to use if the property is not setkey or defaultValue if key is not set@Deprecated public static <T> T[] concatenate(T[] array1, T... array2)
T - the type of the array elementsarray1 - the first arrayarray2 - the second array@Deprecated public static int mapCapacity(int numElements)
numElements - the maximum expected number of elements in the map or set@Deprecated public static int mapCapacity(Collection<?> c)
c - a collection whose size is the maximum expected number of elements in the map or set@Deprecated public static int mapCapacity(Map<?,?> m)
m - a map whose size is the maximum expected number of elements in the map or set