2019-04-24 12:25:46 +00:00
|
|
|
/// List utilities
|
|
|
|
///
|
|
|
|
/// @author Pierre HUBERT
|
|
|
|
|
2019-04-24 15:46:25 +00:00
|
|
|
/// Transform a list of dynamic thins into something a list of ints
|
2021-03-10 18:08:18 +00:00
|
|
|
List<int> listToIntList(List<dynamic> srcList) {
|
2019-04-24 12:25:46 +00:00
|
|
|
List<int> list = List();
|
|
|
|
|
2021-03-10 18:08:18 +00:00
|
|
|
srcList.forEach((e) {
|
2019-04-24 12:25:46 +00:00
|
|
|
list.add(int.parse(e));
|
|
|
|
});
|
|
|
|
|
|
|
|
return list;
|
2019-04-25 06:56:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Find the list of missing elements of a [testList] from a [srcList]
|
2021-03-10 18:08:18 +00:00
|
|
|
List<T> findMissingFromList<T>(List<T> srcList, List<T> testList) {
|
2019-04-25 06:56:16 +00:00
|
|
|
List<T> dest = List();
|
|
|
|
|
2021-03-10 18:08:18 +00:00
|
|
|
testList.forEach((f) {
|
|
|
|
if (!srcList.contains(f) && !dest.contains(f)) dest.add(f);
|
2019-04-25 06:56:16 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
return dest;
|
2021-03-10 18:08:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Find the list of missing elements of a [testList] from a [srcList]
|
|
|
|
Set<T> findMissingFromSet<T>(Set<T> srcList, Set<T> testList) {
|
|
|
|
Set<T> dest = Set();
|
|
|
|
|
|
|
|
testList.forEach((f) {
|
|
|
|
if (!srcList.contains(f)) dest.add(f);
|
|
|
|
});
|
|
|
|
|
|
|
|
return dest;
|
|
|
|
}
|