1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Veseljchak [2.6K]
2 years ago
8

It is common for people to name directories as dir1, dir2, and so on. When there are ten or more directories, the operating syst

em 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);
Computers and Technology
1 answer:
Vikki [24]2 years ago
7 0

Answer:

Here the code is given as follows,

Explanation:

You might be interested in
In Criminal justice, the type of evidence which contradicts a given theory is known as?​
irina [24]

Answer:

In general, scientific evidence are the results of scientific tests used to prove or disprove a theory or hypothesis. In criminal cases, scientific evidence is used to help jurors understand and determine the facts of a case. Explanation:

3 0
2 years ago
What is a banner grab?
alexira [117]
Banner Grabbing is a technique used to gain information about a computer system on a network and the services running on its open ports. Administrators can use this to take inventory of the systems and services on their network.

Hope you find this helpful!
Brainliest and a like is much appreciated!
3 0
2 years ago
Which windows system include new features and extends the functionality
Juli2301 [7.4K]

Critical update

Hope this helps!

3 0
2 years ago
What is a special class of adware that collects data about the user and transmits it over the Internet without the user’s knowle
Stells [14]

Answer:

The answer is "Spyware".

Explanation:

Spyware is a supplementary program that is mounted on your customer computer and it transmits the data without authorization via the Internet. Its business includes ads, private data, and improvements in the user interface, which is why it has become recognized as the special adware class that collects and transmits user information over the web without the user's permission.

7 0
3 years ago
Write a definition in your own words for Raster Graphic. Do not copy and paste please.
Vlada [557]

Answer:

Raster Graphic is a bitmap. They are basically a grid of small pixels that make an image.

6 0
3 years ago
Other questions:
  • You can apply several different worksheet themes from which tab?
    11·2 answers
  • The following program includes fictional sets of the top 10 male and female baby names for the current year. Write a program tha
    15·1 answer
  • I need an answer fast !!! (APEX)
    13·1 answer
  • PLEASE HELP!
    13·2 answers
  • The ____________________ packet-filtering firewall allows only a particular packet with a particular source, destination, and po
    10·1 answer
  • Give 2 examples of when spreadsheets are used.
    15·1 answer
  • You are configuring two PCs for your network, PC-A is given an IP address of 192.168.1.18 and PC-B is given an IP address of 192
    15·1 answer
  • Darcy was working on a presentation on playing chess. Because she chose the Checkerboard animation for her slide title, she had
    15·2 answers
  • If im downloading a game at 4mb/s how many minutes would it take to download 25 GB
    14·2 answers
  • Help asap !!!<br>which component of cpu controls the overall operation of computer..​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!