![subject](/tpl/images/cats/informatica.png)
Computers and Technology, 06.07.2021 23:50 ozieera
It is common for people to name directories as dir1, dir2, and so on. When there are ten or more directories, the operating system displays them in dictionary order, as dir1, dir10, dir11, dir12, dir2, dir3, and so on. That is irritating, and it is easy to fix. Provide a comparator that compares strings that end in digit sequences in a way that makes sense to a human. First compare the part before the digit as strings, and then compare the numeric values of the digits.
Your program should work with the provided test program
DirectorySortDemo. java.
Call the class you write DirectoryComparator. java.
Submit the two files in your submission.
DirectoryComparator. java
DirectorySortDemo. java
import java. util. ArrayList;
import java. util. Arrays;
import java. util. collections;
public class DirectorySortDemo
{
public static void main (String [] args)
{
String dirNames ("dir12", "dir5", "dir9", "dirl", "dir4",
"lab10", "1ab2", "lab7", "lab17", "lab8",
"quiz8", "quiz10", "quiz11", "quiz12",
"dirll", "dir8", "dir7", "dir15", "dir3");
ArrayList directories = new
ArrayList<> (Arrays. asList (dirNames));
System. out. println ("Unsorted List:");
System. out. println (directories);
Collections. sort (directories, new DirectoryComparator ());
System. out. println ():
System. out-println ("Sorted List: ");
System. out.-println (directories);
![ansver](/tpl/images/cats/User.png)
Answers: 2
![](/tpl/images/ask_question.png)
![](/tpl/images/ask_question_mob.png)
Another question on Computers and Technology
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 22.06.2019 09:00
Howard is designing a chair swing ride. the swing ropes are 5 meters long, and in full swing they tilt in an angle of 29° outside chairs to be 2.75 m above the ground in full swing.
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 15:30
The processing of data in a computer involves the interplay between its various hardware components.
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 24.06.2019 07:30
Aproject involves many computing systems working together on disjointed task towards a single goal what form of computing would the project be using
Answers: 3
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 24.06.2019 09:30
Retype the statements, correcting the syntax errors. system.out.println("num: " + songnum); system.out.println(int songnum); system.out.println(songnum " songs"); note: these activities may test code with different test values. this activity will perform two tests: the first with songnum = 5, the second with songnum = 9. see how to use zybooks.
Answers: 1
You know the right answer?
It is common for people to name directories as dir1, dir2, and so on. When there are ten or more dir...
Questions
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/en.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 19.03.2021 20:50
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/ekonomika.png)
Business, 19.03.2021 20:50
![question](/tpl/images/cats/istoriya.png)
History, 19.03.2021 20:50
![question](/tpl/images/cats/mat.png)
Mathematics, 19.03.2021 20:50
![question](/tpl/images/cats/health.png)
Health, 19.03.2021 20:50
![question](/tpl/images/cats/geografiya.png)
Geography, 19.03.2021 20:50
![question](/tpl/images/cats/health.png)
Medicine, 19.03.2021 20:50
![question](/tpl/images/cats/mat.png)
Mathematics, 19.03.2021 20:50
![question](/tpl/images/cats/mat.png)
Mathematics, 19.03.2021 20:50
![question](/tpl/images/cats/istoriya.png)
![question](/tpl/images/cats/istoriya.png)
History, 19.03.2021 20:50
![question](/tpl/images/cats/mat.png)
Mathematics, 19.03.2021 20:50
![question](/tpl/images/cats/mat.png)
Mathematics, 19.03.2021 20:50
![question](/tpl/images/cats/himiya.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 19.03.2021 20:50