Class DataTypeHandling
- java.lang.Object
-
- de.julielab.jcore.ae.coordbaseline.tools.DataTypeHandling
-
public class DataTypeHandling extends Object
This class provides methods which deal with data type conversion.- Author:
- lichtenwald
-
-
Constructor Summary
Constructors Constructor Description DataTypeHandling()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ArrayList<String>appendElements(ArrayList<String> list1, ArrayList<String> list2, String separator)This method is used to append elements of one ArrayList of Strings to another.static StringarrayListToString(ArrayList<String> inputList, String separator)This method is used to convert an ArrayList of Strings to a String using the separator to separate the list elements within the String.static ArrayList<String>arrayToArrayList(String[] array)This method is used to convert a string array to string array list.static ArrayListcloneList(ArrayList inputList)This method is used to simply copy or clone two lists.static boolean[]initializeArray(boolean[] array, boolean value)This method is used to initialize a given boolean array with a boolean valuestatic String[]initializeArray(String[] array, String value)This method is used to initialize a given String array with a given String valuestatic ArrayListreverseList(ArrayList inputList)This method is used to reverse the order of the elements within the input ArrayList.
-
-
-
Method Detail
-
reverseList
public static ArrayList reverseList(ArrayList inputList)
This method is used to reverse the order of the elements within the input ArrayList. The reversed elements will be stored in the output ArrayList.- Parameters:
inputList- the list which content will be reversed and then put into the output list- Returns:
- outputList the list which will be returned after being filled with the reversed content of the input list
-
cloneList
public static ArrayList cloneList(ArrayList inputList)
This method is used to simply copy or clone two lists. In other words, the elements of the inputList will be copied to the outputList.- Parameters:
inputList- the list which content will be copied to the output list.- Returns:
- outputList the list which will be returned after being filled with the content of the input list
-
arrayToArrayList
public static ArrayList<String> arrayToArrayList(String[] array)
This method is used to convert a string array to string array list.- Parameters:
array- String array which will be converted to a string array list- Returns:
- list ArrayList which is the result of the conversion
-
arrayListToString
public static String arrayListToString(ArrayList<String> inputList, String separator)
This method is used to convert an ArrayList of Strings to a String using the separator to separate the list elements within the String.- Parameters:
inputList- ArrayList which elements will be put into the output stringseparator- String which will separate the list elements within the string- Returns:
- outputString String which will contain the list elements separated by the separator
-
appendElements
public static ArrayList<String> appendElements(ArrayList<String> list1, ArrayList<String> list2, String separator)
This method is used to append elements of one ArrayList of Strings to another. Every element of the list2 will be stuck to the corresponging element of the list1 using the separator between them. The output element will be (list1 element)(separator)(list2 element).- Parameters:
list1- ArrayList to which elements the elements of the second list will be addedlist2- ArrayList which elements will be added to the elements of the first listseparator- String which will be put between the elements of the first and the second list to separate them- Returns:
- outputList ArrayList which will contain the elements of both input lists according to the computation
-
initializeArray
public static boolean[] initializeArray(boolean[] array, boolean value)This method is used to initialize a given boolean array with a boolean value- Parameters:
array- boolean array which will be initialized and then returnedvalue- boolean variable which the array will be initialized with- Returns:
- array boolean array which was initialized with the boolean value
-
initializeArray
public static String[] initializeArray(String[] array, String value)
This method is used to initialize a given String array with a given String value- Parameters:
array- String array which will be initialized and then returnedvalue- String variable which the array will be initialized with- Returns:
- array String array which was initialized with the String value
-
-