Class CompatUtil
java.lang.Object
io.github.douira.glsl_transformer.util.CompatUtil
This class contains utility methods that allow maintaining Java 8 API
compatability. (Even though the code is at Java 16 source compatability)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> List<T>listOf(T... items) Creates anArrayListthat contains the given items in the same order.static StringRepeats the given string a number of times.static <T> Set<T>setOf(T item) Creates aHashSetthat contains the given item.static <T> Set<T>setOf(T... items) Creates aHashSetthat contains the given items.static <T> Set<T>setOf(T itemA, T itemB) Creates aHashSetthat contains the given items.
-
Constructor Details
-
CompatUtil
public CompatUtil()
-
-
Method Details
-
repeat
Repeats the given string a number of times. From https://stackoverflow.com/a/1235213- Parameters:
str- The string to repeatn- The number of times to repeat the string- Returns:
- The given string repeated n times
-
setOf
Creates aHashSetthat contains the given items. The heap pollution warning is suppressed as it is inArrays.- Type Parameters:
T- The type of the items- Parameters:
items- The items to add to the set- Returns:
- The set with the given items
-
setOf
Creates aHashSetthat contains the given item.- Type Parameters:
T- The type of the item- Parameters:
item- The item to add to the set- Returns:
- The set with the given item
-
setOf
Creates aHashSetthat contains the given items.- Type Parameters:
T- The type of the items- Parameters:
itemA- The first item to add to the setitemB- The second item to add to the set- Returns:
- The set with the given items
-
listOf
Creates anArrayListthat contains the given items in the same order. This is likely cheaper for making a collection than usingsetOf(Object...).- Type Parameters:
T- The type of the items- Parameters:
items- The items to create the list out of- Returns:
- The list with the given items
-