-
-
Save alamsyahh15/1b45d67c3728a6371a72329673639c34 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
List<int> arrayData = [700,400,200,800,700,100,200,100,300]; | |
List<int> backupData = []; | |
backupData.addAll(arrayData); | |
backupData.sort((a,b) => a.compareTo(b)); | |
print("Output1 => $backupData"); | |
final backupDistinc = []; | |
backupDistinc.addAll(arrayData); | |
backupDistinc.sort((a,b) => b.compareTo(a)); | |
backupDistinc.toSet().toList(); | |
for(int i = 0; i< backupDistinc.length; i++){ | |
final tempList = arrayData.where((e) => e == backupDistinc[i]).toList(); | |
print("Output 2=> ${backupDistinc[i]} length = ${tempList.length}"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment